Skip to content

Make Promise Pool wrapper extend EventEmitter - #567

Merged
sidorares merged 3 commits into
sidorares:masterfrom
Myhlamaeus:master
May 28, 2017
Merged

sidorares merged 3 commits into
sidorares:masterfrom
Myhlamaeus:master

Conversation

@Myhlamaeus

Copy link
Copy Markdown
Contributor

Fix #468

Introduce a new PromisePool constructor into promise.js. PromisePool
inherits from EventEmitter, and the following events are re-emitted
from the underlying Pool instance to it:

  • acquire
  • connection
  • enqueue
  • release

Methods like on can't just be bound to the Pool and added to the object as this would be
wrong in the callback: e.g. this.query wouldn't return a Promise.

Fix #468

Introduce a new PromisePool constructor into promise.js. PromisePool
inherits from EventEmitter, and the following events are re-emitted
from the underlying Pool instance to it:
 - acquire
 - connection
 - enqueue
 - release

Methods like `on` can't just be bound to the Pool as `this` would be
wrong in the callback: e.g. `this.query` wouldn't return a Promise.
@ben-z

ben-z commented May 26, 2017

Copy link
Copy Markdown

@Myhlamaeus While we are at this, can we also make PromiseConnection inherit EventEmitter?

@Myhlamaeus

Myhlamaeus commented May 26, 2017 •

Copy link
Copy Markdown
Contributor Author

@ben-z Sure, just give me a moment.

Malte-Maurice Dreyer added 2 commits May 26, 2017 16:51
The following events are re-emitted from the underlying Connection
instance:
 - error
 - drain
 - connect
 - end
 - enqueue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants