darkterra / mongo-scheduler

Persistent event schedule for node.js using mongo as storage
MIT License
8 stars 8 forks source link

the options [doNotFire] is not supported #1

Closed AlexanderProd closed 5 years ago

AlexanderProd commented 5 years ago

Whenever I provide the doNotFire option I get the following console log the options [doNotFire] is not supported like this const scheduler = new Scheduler('mongodb://localhost:27017/schedule-test', { doNotFire: false });

When I don't provide an options object though it crashes with the following message. Cannot read property 'doNotFire' of undefined

I've worked around this by hardcoding true instead of !opts.doNotFire inside of scheduler.js if(true) whenReady(initialize)();

darkterra commented 5 years ago

Hi AlexanderProd!

Indeed, the opts object is not supposed to be used in the file 'lib / scheduler.js' since it is only used to initialize the options object. When I fork the project, I did not pay attention to this small error, but it is now corrected (version 1.1.5)!

Regarding the warning the options [doNotFire] is not supported, I think it's your IDE that displays it. Some IDE that I use as for example Visual Code, displays this information, but no worries, if you set this option to true it should not have any vent since the initialize method will not be called ( it is the latter who is responsible for regularly checking BDD if there are events to trigger). Otherwise if you set to false or you dosen't set the doNotFire option the module will work normally and trigger events.

Can you update the mongo-scheduler-more module and tell me if it's ok?

AlexanderProd commented 5 years ago

Hi,

Yeah that fixed it and you're right the console log came from visual studio code. Thanks for the quick fix!

darkterra commented 5 years ago

Just for info, after re-reading the code, I think it's the MongoClient () driver that returns this warning the options [doNotFire] is not supported since the options given to mongo-scheduler-more are passed to the driver.

I will see to make a separation of the options own to mongo-scheduler-more and that passed to the driver in the next update.