Skip to content

Commit

Permalink
Reduce logging
Browse files Browse the repository at this point in the history
  • Loading branch information
EarthlingDavey committed Dec 3, 2024
1 parent c340043 commit fbb1781
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions conf/node/controllers/httrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ export const waitForHttrackComplete = async (
) => {
const intervalSeconds = 1;
const maxIterations = timeOutSeconds / intervalSeconds;
const logFrequency = 5 * 60; // Log every 5 minutes
let iterations = 0;

// Wait for hts-cache/new.txt to exist.
Expand All @@ -227,9 +228,13 @@ export const waitForHttrackComplete = async (
iterations++ < maxIterations &&
fs.existsSync(`${dest}/hts-in_progress.lock`)
) {
console.log("Waiting for httrack to complete ... ");
if (iterations < 10 || iterations % logFrequency === 0) {
const elapsedTime = new Date(iterations * intervalSeconds * 1000).toISOString().substring(11, 19);
console.log(
`Waiting for httrack to complete ... ${elapsedTime} elapsed`,
);
}
await new Promise((resolve) => setTimeout(resolve, intervalSeconds * 1000));
iterations++;
}

return {
Expand Down
2 changes: 1 addition & 1 deletion conf/node/controllers/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ export const main = async ({ url, agency, depth }) => {
// Clean up the snapshot directory
await fs.rm(paths.fs, { recursive: true, force: true });

console.log("Snapshot complete", { url, agency, depth });
console.log("Snapshot complete", { url: url.href, agency, depth });
};

0 comments on commit fbb1781

Please sign in to comment.