Skip to content

Commit

Permalink
Fix missusage of async until and whilst
Browse files Browse the repository at this point in the history
Issue: BB-585
  • Loading branch information
KillianG committed Nov 19, 2024
1 parent b906d33 commit 131c31e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion extensions/lifecycle/conductor/LifecycleConductor.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ class LifecycleConductor {
},
(nBucketsListed, next) => {
async.until(
() => nBucketsQueued === nBucketsListed,
cb => cb(null, nBucketsQueued === nBucketsListed),
unext => setTimeout(unext, 1000),
next);
},
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/ingestion/pauseResumeState.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,11 @@ describe('Ingestion Pause/Resume', function d() {
this.iPopulator._pauseService(secondLocation);
this.iPopulator.applyUpdates();
let pausedList = this.iPopulator.getPausedLocations();
return async.whilst(() =>
return async.whilst(cb => cb(null,
Object.keys(pausedList).includes(firstLocation) ||
pausedList[secondLocation] === undefined ||
(pausedList[secondLocation] &&
pausedList[secondLocation].constructor.name !== 'Job'),
pausedList[secondLocation].constructor.name !== 'Job')),
cb => setTimeout(() => {
this.iPopulator._resumeService(firstLocation);
this.iPopulator._resumeService(secondLocation, futureDate);
Expand Down
16 changes: 8 additions & 8 deletions tests/functional/replication/pauseResumeState.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ describe('CRR Pause/Resume status updates', function d() {
qpSite2.scheduleResume(futureDate);

// wait for clients/jobs to set
return async.whilst(() => (
return async.whilst(cb => cb(null, (
!consumer1 && !consumer2 && !qpSite2.scheduledResume
), cb => setTimeout(() => {
)), cb => setTimeout(() => {
consumer1 = qpSite1._consumer;
consumer2 = qpSite2._consumer;
return cb();
Expand Down Expand Up @@ -125,9 +125,9 @@ describe('CRR Pause/Resume status updates', function d() {
replayProcessor2.scheduleResume(futureDate);

// wait for clients/jobs to set
return async.whilst(() => (
return async.whilst(cb => cb(null, (
!replayConsumer1 && !replayConsumer2 && !replayProcessor2.scheduledResume
), cb => setTimeout(() => {
)), cb => setTimeout(() => {
replayConsumer1 = replayProcessor1._consumer;
replayConsumer2 = replayProcessor2._consumer;
return cb();
Expand All @@ -138,8 +138,8 @@ describe('CRR Pause/Resume status updates', function d() {
afterEach(done => {
consumer1.resume();
consumer2.pause();
async.whilst(() => qpSite1.scheduledResume !== null ||
!qpSite2.scheduledResume,
async.whilst(cb => cb(null, qpSite1.scheduledResume !== null ||
!qpSite2.scheduledResume),
cb => setTimeout(() => {
qpSite1._deleteScheduledResumeService();
qpSite2.scheduleResume(futureDate);
Expand All @@ -153,8 +153,8 @@ describe('CRR Pause/Resume status updates', function d() {
afterEach(done => {
replayConsumer1.resume();
replayConsumer2.pause();
async.whilst(() => replayProcessor1.scheduledResume !== null ||
!replayProcessor2.scheduledResume,
async.whilst(cb => cb(null, replayProcessor1.scheduledResume !== null ||
!replayProcessor2.scheduledResume),
cb => setTimeout(() => {
replayProcessor1._deleteScheduledResumeService();
replayProcessor2.scheduleResume(futureDate);
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/lifecycle/LifecycleTask.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2109,7 +2109,7 @@ describe('lifecycle task helper methods', () => {

let count = 0;
async.whilst(
() => count++ < 102,
cb => cb(null, count++ < 102),
cb => lct._retryEntry({
logFields: { count, totalRetries: lct._totalRetries },
log: fakeLogger,
Expand Down

0 comments on commit 131c31e

Please sign in to comment.