trigger(data: T, opts?: Bull.JobOptions) {
this.queue.add(data, opts);
}
-}
\ No newline at end of file
+}
export const tick = new Task<Tick>('tick', async (task, job) => {
const nextTick = job.data.lastTick+1;
+ const start = Date.now();
// +population*1.1 is where we take into account farms for bonus food production
let sql = `update cities set
console.log(e);
}
finally {
- const now = new Date();
- const nextTickAt = 60 - now.getMinutes();
- console.log(`Tick scheduled for ${nextTickAt}min`);
-
- task.trigger({
- lastTickAt: +now,
- lastTick: nextTick
- }, { delay: 60000 * nextTickAt});
+ console.log('Tick complete', Date.now() - start);
}
-
});