chillman
simple dampening library for node.js that makes sure that multiple successive calls to resolve a resource waits after the first, so that the resource is only resolved once per resource resolving storm
Last updated 4 years ago by psvensson .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install chillman 
SYNC missed versions from official npm registry.

chillman

simple dampening library for node.js that makes sure that multiple successive calls to resolve a resource waits after the first, so that the resource is only resolved once per resource resolving storm.

The use case is where you have an expensive function, that takes some time and resolves a resource for you, and when you get it back you put it in a cach, of course. So that the next orderly request doens't have to go all the way over the network again.

The problem is that when you retsrat your service, you'll get a gazillion calls to the function - all of which happens too quickly for your cache to be filled.

What Chillman does is to remember what you asked for in the first fucntion call for that whatever it is, and to paus all subsequent calls for that same resource. When the very first call gets resolved, the other following calls will be continued, so a gazillion calls will only result in one resource utilization.

See tests for example. Promises are used heavillt and Chillman depends on that the resource-fullfillment function anse return a promise.

Current Tags

  • 1.0.2                                ...           latest (2 years ago)

3 Versions

  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 3
Dependencies (4)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |