I need a function to be called every day at a given hour with generators (yields), doing my search I've found out two node modules that enable me to do this, one is node-schedule and the other one is node-cron
Node-cron does not seems to support generators
Node-schedule should have the support but it seems to not work as pointed out here: issue #325
To be more clear about what I'm trying to accomplish I attach the same code the issue #325 has:
const date = momemt().add(1, 's'); // 1 second after now.
schedule.scheduleJob('taksid', date, function*(){
console.log('Hi');
const result = yield Message.findAll();
console.log('Result: ' + result);
});
As specified in the issue, 'Hi' gets printed out while 'result' does not.
I'm not able to find out a way to schedule a function with generators, if some of you know how to do it that would be great! Thank in advance guys
via Ezechiele
No comments:
Post a Comment