Fixed eslint errors.
This commit is contained in:
parent
c11d1a1cbf
commit
c17bc9f2cf
10 changed files with 268 additions and 280 deletions
35
test/e2e/lib/worker-counter.js
Normal file
35
test/e2e/lib/worker-counter.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
'use strict';
|
||||
|
||||
const Promise = require('bluebird');
|
||||
|
||||
class WorkerCounter {
|
||||
constructor() {
|
||||
this.counter = 0;
|
||||
}
|
||||
|
||||
enter() {
|
||||
this.counter++;
|
||||
}
|
||||
|
||||
exit() {
|
||||
this.counter--;
|
||||
}
|
||||
|
||||
async waitForEmpty() {
|
||||
const self = this;
|
||||
|
||||
function wait(resolve) {
|
||||
if (self.counter === 0) {
|
||||
resolve();
|
||||
} else {
|
||||
setTimeout(wait, 500, resolve);
|
||||
}
|
||||
}
|
||||
|
||||
return new Promise(resolve => {
|
||||
setTimeout(wait, 500, resolve);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = WorkerCounter;
|
Loading…
Add table
Add a link
Reference in a new issue