medikoo / deferred

Modular and fast Promises implementation for JavaScript
ISC License
364 stars 20 forks source link

Add a note in the README explaining the behavior of `deferred.gate` on chained promises #21

Closed madarche closed 11 years ago

madarche commented 11 years ago

Hello,

When reading the code of deferred.gate it seems to me that deferred.gate only limits the concurrency of the "first" promise calls it has as a param. If so, it means that when there are chained promises, the later ones will not have their concurrency limited.

Whether I'm right or not, clarifying this point in the doc would undoubtedly be useful.

Thanks!

madarche commented 11 years ago

Actually I think I'm wrong: deferred.gate limits the concurrency of promises based on the fact that they are resolved or not. So any chaining will be handled by deferred.gate.

But I'm having problems with my usage of deferred.gate that doesn't totally protect my application from opening too many files.

medikoo commented 11 years ago

deferred.gate provides function wrapper for function that returns promise. It doesn't do anything to promise objects, it just limits creation of them by blocking calls to function it wraps.

Can you show me a snippet of your code, one you have problems with?

madarche commented 11 years ago

Thank you!