Jump to content
McKay Development

Add condition before create once event listener


Recommended Posts

Posted

Hi, if i'll call method getPersonas few times, and don't received response from steam - this events will stuck, with error.

Quote

"Possible EventEmitter memory leak detected. 11 user#steamid64 listeners added to [SteamUser]. Use emitter.setMaxListeners() to increase limit" . 

For example - you can reproduce this error when disable ethernet, and call this method 15 times.
When i added condition it works without error

ids.forEach((id) => {
  if( !this._events[`user#${id}`] ) {
    this.once('user#' + id, receive);
  }
});


I suggest add this condition to all once events created, because steam may not response and events listeners may stuck 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...