Skip to content

Instantly share code, notes, and snippets.

@isuvorov

isuvorov/pattern.js

Created Oct 15, 2015
Embed
What would you like to do?
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
You can’t perform that action at this time.