Description
I am using scheduled event script to create an event. When I test it in my local system using URL http://localhost:10001/web/test#
The event is getting executed immediately and function is called instead it should work on the given time
function createTicket(args) {
console.log('Creating ticket');
}
exports = {
events: [
{ event: "onScheduledEvent", callback: "onScheduledEventHandler" }
],
createSchedule: function(args) {
$schedule.create({
name: "task_reminder2",
data: {task_id: 100001},
schedule_at: "2021-11-17T07:43:00.860Z",
})
.then(function(data) {
//"data" is a json with status and message.
console.log(data);
}, function(err) {
//"err" is a json with status and message.
console.log(err);
});
},
onScheduledEventHandler: function(payload) {
console.log(new Date);
createTicket();
}
}
```
Current Time in output - 2021-11-17T07:40:21.225Z
Scheduled time - 2021-11-17T07:43:21.225Z
Please help on this
As I recall, the handlers attached to a particular schedule are supposed to be invoked immediately in the initial releases for local simulation of scheduled events.
However, in future revisions of the local simulation, there were few updates. Let me check try this locally and get back to you, @franklin .