Skip to content

Commit

Permalink
S3UTILS-148: fix logging after 30s
Browse files Browse the repository at this point in the history
  • Loading branch information
williamlardier committed Oct 25, 2023
1 parent 766f4cb commit 8f7df21
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions utils/S3UtilsMongoClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@ class S3UtilsMongoClient extends MongoClientInterface {

const usersBucketCreationDatesMap = usersBucketCreationDatesArray
.reduce((map, obj) => ({ ...map, [obj._id]: obj.value.creationDate }), {});
const startCursorDate = new Date();
let startCursorDate = new Date();
let processed = 0;
await cursor.forEach(
res => {
// Periodically display information about the cursor
// if more than 30s elapsed
if (Date.now() - startCursorDate > 30000) {
const currentDate = Date.now();
if (currentDate - startCursorDate > 30000) {
startCursorDate = currentDate;
log.info('Processing cursor', {
method: 'getObjectMDStats',
bucketName,
Expand Down

0 comments on commit 8f7df21

Please sign in to comment.