Skip to content

Commit

Permalink
Added start/end console.logs for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
maxxcrawford committed Aug 10, 2020
1 parent 44762ae commit bdc0c93
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/collect-unresolved-breaches-addresses.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,17 @@ function getArgsValue(argument) {
}

(async () => {
console.log("init");

console.log(process.argv);
console.log("Script starting");

const allHibpBreachesResp = await HIBP.req("/breaches");
const allHibpBreaches = allHibpBreachesResp.body;

const limitQuery = getArgsValue("--limit");
const cohortSize = getArgsValue("--cohort-size");

console.log(`The limit of this query is ${limitQuery}`);
console.log(`The target cohort size of this query is ${cohortSize}`);

// "SELECT primary_email, primary_sha1 FROM subscribers WHERE signup_language LIKE 'en%' AND breaches_resolved IS NULL ORDER BY random();"

const results = await knex("subscribers").where("signup_language", "like", "en%").andWhere({breaches_resolved: null}).orderByRaw("RANDOM()").limit(limitQuery).select("primary_email", "primary_sha1");
Expand All @@ -71,5 +72,6 @@ function getArgsValue(argument) {
if (isValidCohortMember) { cohort.push(record.primary_email); }
}

console.log("Script completed! See final output:");
console.log(cohort.toString());
})();

0 comments on commit bdc0c93

Please sign in to comment.