mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-11 00:08:30 +01:00
chore: re-add max listeners (#6522)
## About the changes Some tests are reporting this error: `MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 UPDATE_REVISION listeners added to [ConfigurationRevisionService]. Use emitter.setMaxListeners() to increase limit` I thought it's because of this change https://github.com/Unleash/unleash/pull/6400#discussion_r1511494201 but it was not. I've managed to get a trace of the issue following this https://stackoverflow.com/q/62897235/239613 and now we can identify `ConfigurationRevisionService` as one explanation. The reason is that it's a singleton that should be cleaned up after tests. E.g.: https://github.com/Unleash/unleash/actions/runs/8248332132/job/22558419656?pr=6517#step:8:15
This commit is contained in:
parent
6278cdb6c7
commit
16507a971b
@ -45,7 +45,7 @@
|
||||
"prebuild:watch": "yarn run clean",
|
||||
"build:watch": "tsc -w --strictNullChecks false",
|
||||
"prebuild": "yarn run clean",
|
||||
"test": "NODE_ENV=test PORT=4243 jest",
|
||||
"test": "NODE_ENV=test PORT=4243 node --trace-warnings node_modules/.bin/jest",
|
||||
"test:unit": "NODE_ENV=test PORT=4243 jest --testPathIgnorePatterns=src/test/e2e --testPathIgnorePatterns=dist",
|
||||
"test:docker": "./scripts/docker-postgres.sh",
|
||||
"test:report": "NODE_ENV=test PORT=4243 jest --reporters=\"default\" --reporters=\"jest-junit\"",
|
||||
|
@ -78,4 +78,8 @@ export default class ConfigurationRevisionService extends EventEmitter {
|
||||
|
||||
return this.revisionId;
|
||||
}
|
||||
|
||||
destroy(): void {
|
||||
ConfigurationRevisionService.instance?.removeAllListeners();
|
||||
}
|
||||
}
|
||||
|
@ -52,6 +52,9 @@ describe('responseTimeMetrics old behavior', () => {
|
||||
getAppCountSnapshot: jest.fn(),
|
||||
};
|
||||
const eventBus = new EventEmitter();
|
||||
afterEach(() => {
|
||||
eventBus.removeAllListeners();
|
||||
});
|
||||
|
||||
test('uses baseUrl and route path to report metrics', async () => {
|
||||
let timeInfo: any;
|
||||
|
Loading…
Reference in New Issue
Block a user