totaljs / framework

Node.js framework
http://www.totaljs.com
Other
4.36k stars 450 forks source link

F.clearSchedule does not work #606

Closed gmenih closed 6 years ago

gmenih commented 6 years ago

I have this code in one of my controller's install method:

let reminderId = null;
F.on('settings.changed', (settings) => {
    if (reminderId) {
        F.clearSchedule(reminderId);
    }
    F.schedule(settings.reminderTime, '1 day', () => {
        F.mail('my@email.com', 'Subject'); // <-- i send an email to my address
    });
});

This should send an email to me every day, based on what I set in the settings. I put the F.emit('settings.changed') somewhere, where it would get called 500+ times a day (my mistake), I would receive 500 emails every day, even though I clear the schedule before registering it again.

petersirka commented 6 years ago

Hi, you're right ... it's a bug. I have fixed it. Try stable beta $ npm install total.js@beta.