When reinitializing, an 'error' event handler is added to the old client, which is not later removed:
|
dbClient.once("error", error => connectionLogger(`Previous DB client errored after reconnecting already:`, error)) |
Perhaps an idea to wait for the client to end and then remove the listeners again?
await dbClient.end();
dbClient.removeAllListeners();