Fix max listener warning from livequery server (#7083)
* fix max listner warning * fix * Clean test log
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user