Skip to content

Commit

Permalink
Fix max listener warning from livequery server (#7083)
Browse files Browse the repository at this point in the history
* fix max listner warning

* fix

* Clean test log
  • Loading branch information
Moumouls authored Dec 21, 2020
1 parent 41a052c commit 05f5aa0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions spec/EnableExpressErrorHandler.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const request = require('../lib/request');

describe('Enable express error handler', () => {
it('should call the default handler in case of error, like updating a non existing object', async done => {
spyOn(console, 'error');
const parseServer = await reconfigureServer(
Object.assign({}, defaultConfiguration, {
enableExpressErrorHandler: true,
Expand Down
4 changes: 4 additions & 0 deletions src/Adapters/PubSub/EventEmitterPubSub.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ function createPublisher(): any {
}

function createSubscriber(): any {
// createSubscriber is called once at live query server start
// to avoid max listeners warning, we should clean up the event emitter
// each time this function is called
emitter.removeAllListeners();
return new Subscriber(emitter);
}

Expand Down

0 comments on commit 05f5aa0

Please sign in to comment.