You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Behavior:
After several iterations using the same connection node shows the warning:
MaxListenersExceededWarning: Possible EventEmitter memory leak detected. XX data listeners added to [Socket]
Identified cause: socket.onData functions are not unsubscribed after returning promise in connect() and write() methods()
Proposed patch:
use a helper function to resolve the promise, using it to unsubscribe from event:
Original code:
`
public write(queries: string[]): Promise<{ [prop: string]: string }[] | []> {
return new Promise((resolve, reject) => {
this.writeWords(queries);
Behavior:
After several iterations using the same connection node shows the warning:
MaxListenersExceededWarning: Possible EventEmitter memory leak detected. XX data listeners added to [Socket]
Identified cause: socket.onData functions are not unsubscribed after returning promise in connect() and write() methods()
Proposed patch:
use a helper function to resolve the promise, using it to unsubscribe from event:
Original code:
`
public write(queries: string[]): Promise<{ [prop: string]: string }[] | []> {
return new Promise((resolve, reject) => {
this.writeWords(queries);
}
proposed change
public write(queries: string[]): Promise<{ [prop: string]: string }[] | []> {
return new Promise((resolve, reject) => {
this.writeWords(queries);
}
`
The text was updated successfully, but these errors were encountered: