Skip to content

Commit 7c39688

Browse files
committed
code fixups post bumps
1 parent 8f411e7 commit 7c39688

9 files changed

Lines changed: 22 additions & 24 deletions

File tree

CRR/ReplicationStatusUpdater.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ class ReplicationStatusUpdater {
352352
});
353353
},
354354
),
355-
callback => {
355+
async () => {
356356
if (this._nUpdated >= this.maxUpdates || this._nProcessed >= this.maxScanned) {
357357
this._logProgress();
358358
let remainingBuckets;
@@ -378,12 +378,12 @@ class ReplicationStatusUpdater {
378378
+ `VERSION_ID_MARKER=${this._VersionIdMarker}`;
379379
}
380380
this.log.info(message);
381-
return callback(null, false);
381+
return false;
382382
}
383383
if (this._VersionIdMarker || this._KeyMarker) {
384-
return callback(null, true);
384+
return true;
385385
}
386-
return callback(null, false);
386+
return false;
387387
},
388388
err => {
389389
this._bucketInProgress = null;

CompareRaftMembers/BlockDigestsStorage.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class BlockDigestsStorage extends stream.Writable {
4141
const { size, digest, lastKey } = blockInfo;
4242
this.cargo.push({
4343
type: 'put',
44-
key: lastKey,
44+
key: lastKey, // index by last block key for efficient lookup
4545
value: JSON.stringify({ size, digest }),
4646
});
4747
// heuristic to have basic flow control: delay the callback
@@ -57,7 +57,7 @@ class BlockDigestsStorage extends stream.Writable {
5757
if (this.cargo.idle()) {
5858
this.db.close(callback);
5959
} else {
60-
this.cargo.drain (() => {
60+
this.cargo.drain(() => {
6161
this.db.close(callback);
6262
});
6363
}

CountItems/CountWorkerObj.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@ class CountWorkerObj {
2121
}
2222
});
2323
this._worker.on('message', data => {
24-
if (data.owner !== 'scality') {return;}
24+
if (data.owner !== 'scality') {
25+
return;
26+
}
2527
const cb = this._getCallback(data.id);
26-
if (!cb) {return;}
28+
if (!cb) {
29+
return;
30+
}
2731
switch (data.type) {
2832
case 'setup':
2933
if (data.status === 'passed') {
@@ -81,7 +85,9 @@ class CountWorkerObj {
8185
}
8286

8387
_getCallback(id) {
84-
if (!this.callbacks.has(id)) {return null;}
88+
if (!this.callbacks.has(id)) {
89+
return null;
90+
}
8591
const ret = this.callbacks.get(id);
8692
this.callbacks.delete(id);
8793
return ret.callback;

StalledRetry/StalledRequestHandler.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,8 @@ class StalledRequestHandler {
7171

7272
_waitForCompletion(cb) {
7373
async.whilst(
74-
callback => {
75-
callback(null, !this.killed && this.isInProgress());
76-
},
77-
next => setTimeout(next, 1000),
74+
async () => (!this.killed && this.isInProgress()),
75+
done => setTimeout(done, 1000),
7876
cb
7977
);
8078
}

VerifyReplication/verifyReplication.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function handlePrefixes(prefixList, cb) {
8888
bucket: statusObj.srcBucket,
8989
prefix,
9090
listingLimit,
91-
};
91+
};
9292
return listAndCompare(params, done);
9393
}, cb);
9494
}

compareBuckets/compareBuckets.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ function compareBuckets(params, log, cb) {
9494
log.error('Error fetching src bucket', { error: err });
9595
return _done(err);
9696
}
97-
srcContents = contents || [];
97+
srcContents = contents;
9898
srcDone = !isTruncated;
9999
bucketdSrcParams.marker = marker;
100100
statusObj.srcKeyMarker = marker;
@@ -114,7 +114,7 @@ function compareBuckets(params, log, cb) {
114114
log.error('Error fetching dst bucket', { error: err });
115115
return _done(err);
116116
}
117-
dstContents = contents || [];
117+
dstContents = contents;
118118
dstDone = !isTruncated;
119119
bucketdDstParams.marker = marker;
120120
statusObj.dstKeyMarker = marker;
@@ -220,9 +220,7 @@ function compareBuckets(params, log, cb) {
220220
return process.nextTick(() => done(null));
221221
});
222222
},
223-
callback => {
224-
callback(null, !srcDone || !dstDone || srcContents.length > 0 || dstContents.length > 0);
225-
},
223+
async () => (!srcDone || !dstDone || srcContents.length > 0 || dstContents.length > 0),
226224
err => {
227225
statusObj.dstBucketInProgress = null;
228226
statusObj.srcBucketInProgress = null;

repairDuplicateVersionIds.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,6 @@ function repairObject(objInfo, cb) {
154154
// use "versionId" from the parsed metadata instead of
155155
// `objInfo.firstVersionId`, since it may have changed
156156
// since the scan ran
157-
//
158-
159157
[md.versionId] = versionIds;
160158
return putObjectMetadata(objInfo.objectUrl, md, err => {
161159
if (err) {

service-level-sidecar/bucketd.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ async function* listBuckets(log) {
3636

3737
while (true) {
3838
let res;
39-
40-
try {
39+
try {
4140
res = await listObjects(usersBucket, { ...listingParams, gt }, log);
4241
} catch (error) {
4342
if (error.NoSuchBucket) {

verifyBucketSproxydKeys.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,6 @@ function listBucketIter(bucket, cb) {
417417
if (vidSepPos === -1) {
418418
const reVersionIds = /"versionId":"([^"]*)"/g;
419419
const versionIds = [];
420-
421420
while (true) {
422421
const reVersionIdMatch = reVersionIds.exec(item.value);
423422
if (!reVersionIdMatch) {

0 commit comments

Comments
 (0)