Skip to content

Instantly share code, notes, and snippets.

@isuvorov
Created October 15, 2015 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isuvorov/e46592f387701f2d6801 to your computer and use it in GitHub Desktop.
Save isuvorov/e46592f387701f2d6801 to your computer and use it in GitHub Desktop.
function pool(callback, timeout){
setTimeout(function(){
callback(function(err){
if(err) return false; // exit from pool
pool(callback, timeout);
})
}, timeout);
}
// Usage
var doSomeThingWithDataBase = function(){};
pool(doSomeThingWithDataBase, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment