Skip to content

Commit

Permalink
feat(1610): Removed changes by commit d8abcf7
Browse files Browse the repository at this point in the history
  • Loading branch information
pritamstyz4ever committed Nov 1, 2019
1 parent d8abcf7 commit 8739966
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 24 deletions.
20 changes: 8 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,15 @@ class ExecutorQueue extends Executor {

this.multiWorker.start();
this.scheduler.connect().then(() => this.scheduler.start());
}

/**
* Cleanup any reladed processing
*/
async cleanUp() {
try {
await this.multiWorker.end();
await this.scheduler.end();
await this.queue.end();
} catch (err) {
winston.error(`failed to end executor queue: ${err}`);
}
process.on('SIGTERM', () => {
this.multiWorker.end().catch((err) => {
winston.error(`failed to end the worker: ${err}`);
}).then(() => this.scheduler.end()).catch((err) => {
winston.error(`failed to end the scheduler: ${err}`);
process.exit(128);
});
});
}

/**
Expand Down
13 changes: 1 addition & 12 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ describe('index test', () => {
delDelayed: sinon.stub().resolves(1),
connection: {
connected: false
},
end: sinon.stub().resolves()
}
};
resqueMock = {
Queue: sinon.stub().returns(queueMock),
Expand Down Expand Up @@ -608,16 +607,6 @@ describe('index test', () => {
});
});

describe('cleanUp', () => {
it('worker.end() is called', () => {
executor.cleanUp().then(() => {
assert.calledWith(spyMultiWorker);
assert.calledWith(spyScheduler);
assert.calledWith(queueMock.end);
});
});
});

describe('stats', () => {
it('returns the correct stats', () => {
assert.deepEqual(executor.stats(), {
Expand Down

0 comments on commit 8739966

Please sign in to comment.