fix: remove event listener declarations to avoid memory leak#407
fix: remove event listener declarations to avoid memory leak#407Freezystem wants to merge 3 commits intomoleculerjs:masterfrom
Conversation
I removed event listener declaration from the connection script to avoid memory leaks. Instanciating several services including the `moleculer-db-adapter-mongoose` mixin will result on 3 event listeners declared by services, thus, node is emitting a warning on possible memory leak. It's better to let the user instanciate his own event listener to avoid this issue
|
I mean the warning, but it won't cause memory leak issue because the number of loaded services doesn't change in normal production env, only in development. But it can cause issue if you don't see the connection errors on the console, just that the broker is not started and waiting for something but no any information. |
|
I would argue that users may define their listeners by themselves if they need them to log something. |
I removed event listener declaration from the connection script to avoid memory leaks.
Instanciating several services including the
moleculer-db-adapter-mongoosemixin will result on 3 event listeners declared by services, thus, node is emitting a warning on possible memory leak.It's better to let the user instanciate his own event listener to avoid this issue.
Here is the warnings I got:

fixes #262