Created
August 31, 2016 12:57
-
-
Save ermst4r/aac154714b516a315ecb23f2a9040679 to your computer and use it in GitHub Desktop.
sync
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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