Skip to content

Commit

Permalink
fix(tests): shut down events before worker
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerald Baulig committed Sep 4, 2023
1 parent 9eab4ad commit eeab2ed
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
24 changes: 12 additions & 12 deletions src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,24 +336,24 @@ export class Worker {
});

// start server
await (db as Arango).db.version().then(
v => this.logger.verbose(v),
e => this.logger.error(e)
);

this.server.on('serving', (...args: any) => {
this.logger.info('server is ready and serving');
});
await this.server.start();
this.logger.info('server started successfully');
}

async stop(): Promise<any> {
this.logger.info('Shutting down');
await Promise.all([
this.server?.stop(),
this.events?.stop(),
this.offsetStore?.stop(),
await Promise.allSettled([
this.events?.stop().catch(
err => this.logger.error(err)
)
]);
await Promise.allSettled([
this.server?.stop().catch(
err => this.logger.error(err)
),
this.offsetStore?.stop().catch(
err => this.logger.error(err)
),
]);
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/ordering-srv.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe('The Ordering Service:', () => {
});

after(async function() {
this.timeout(15000);
this.timeout(30000);
await Promise.allSettled([
client?.delete({ collection: true }),
topics.removeListener('orderCreated', onOrderCreated),
Expand Down

0 comments on commit eeab2ed

Please sign in to comment.