From d7a99a33baf2b0ac6e95c4eb06ad72db68af5927 Mon Sep 17 00:00:00 2001 From: williamlardier Date: Wed, 11 Oct 2023 18:14:16 +0200 Subject: [PATCH] fixups --- CountItems/CountMaster.js | 5 ++++- utils/S3UtilsMongoClient.js | 14 +++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CountItems/CountMaster.js b/CountItems/CountMaster.js index 522c7728..52e2cac9 100644 --- a/CountItems/CountMaster.js +++ b/CountItems/CountMaster.js @@ -42,11 +42,14 @@ class CountMaster { }); return next(err); } + this.log.info('ot buckets infos', { + bucketCount: bucketList.bucketCount, + }); this.manager.addWork(bucketList); return next(); }), next => this.manager.start(next), - next => this.client.updateStorageConsumptionMetrics(this.manager.store, this.manager.dataMetrics, this._log, next), + next => this.client.updateStorageConsumptionMetrics(this.manager.store, this.manager.dataMetrics, this.log, next), ], err => { if (err) { this.log.error('error occurred in count items job', { diff --git a/utils/S3UtilsMongoClient.js b/utils/S3UtilsMongoClient.js index 9d006e0c..b8294c4d 100644 --- a/utils/S3UtilsMongoClient.js +++ b/utils/S3UtilsMongoClient.js @@ -62,6 +62,7 @@ class S3UtilsMongoClient extends MongoClientInterface { log.info('Processing cursor', { method: 'getObjectMDStats', bucketName, + processed, }); } const { data, error } = this._processEntryData( @@ -525,17 +526,20 @@ class S3UtilsMongoClient extends MongoClientInterface { try { const bucketInfos = []; const collInfos = await this.db.listCollections().toArray(); - await async.eachLimit(collInfos, 10, async value => { + for await (const value of collInfos) { if (this._isSpecialCollection(value.name)) { // skip - return; + continue; } const bucketName = value.name; try { const bucketInfo = await new Promise((resolve, reject) => { this.getBucketAttributes(bucketName, log, (err, info) => { - if (err) reject(err); - else resolve(info); + if (err) { + reject(err); + } else { + resolve(info); + } }); }); bucketInfos.push(bucketInfo); @@ -553,7 +557,7 @@ class S3UtilsMongoClient extends MongoClientInterface { throw errors.InternalError; } } - }); + } return cb(null, { bucketCount: bucketInfos.length, bucketInfos,