simple module that creates a database model to keep track of sync tasks by batch id
try to use your module's name for the batch id to ensure it is unique
currently the main methods that get exposed are
``` tasks.syncTasks().then(() => { console.log('sync done') }) ``` Resync the dbs - ensures your db has model defined
getLatestTask and checkEndOfTasks
getLatestTask gets the batchSize and pageNumber of the last task it is a promise
checkEndOfTasks checks if all tasks are finished and if so adds a task with pageNumber 0
(@todo you actually need to add this so it creates that page 0 task) so that the crons will start from the
beginning
``` new CronJob('*/5 * * * * *', function() { tasks.getLatestTask(batchCode, defaultTask).then(function(r) { users.batchAddUserProfiles(r.batchSize, r.pageNumber + 1, 'aao') .done(function(res) { console.log('finished sync') tasks.checkEndOfTasks(batchCode) }) }) }, null, true, 'America/Los_Angeles'); Example - cron job every 5 seconds
<h2>Environment Variables</h2>
the following env variables must be set. for a connection string for dbhost value use everything after the @ and before the : and port
dbhost dbname dbuser dbpassword dbport