Skip to content

Instantly share code, notes, and snippets.

@ermst4r
Created August 31, 2016 12:57
Show Gist options
  • Save ermst4r/aac154714b516a315ecb23f2a9040679 to your computer and use it in GitHub Desktop.
Save ermst4r/aac154714b516a315ecb23f2a9040679 to your computer and use it in GitHub Desktop.
sync
var page = 1,
lastPage = 5000; // force sync, by incresing this counter
async.whilst(function () {
return page <= lastPage;
},
function (next) {
// BUSINESS LOGIC HERE
// DON'T FORGET TO ADD page++ and next() into a callback
page++;
next();
});
},
function (err) {
// All things are done!
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment