Skip to content

Commit

Permalink
fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
williamlardier committed Oct 11, 2023
1 parent c130230 commit d7a99a3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
5 changes: 4 additions & 1 deletion CountItems/CountMaster.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand Down
14 changes: 9 additions & 5 deletions utils/S3UtilsMongoClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class S3UtilsMongoClient extends MongoClientInterface {
log.info('Processing cursor', {
method: 'getObjectMDStats',
bucketName,
processed,
});
}
const { data, error } = this._processEntryData(
Expand Down Expand Up @@ -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);
Expand All @@ -553,7 +557,7 @@ class S3UtilsMongoClient extends MongoClientInterface {
throw errors.InternalError;
}
}
});
}
return cb(null, {
bucketCount: bucketInfos.length,
bucketInfos,
Expand Down

0 comments on commit d7a99a3

Please sign in to comment.