Schedule / Cron Service in NodeBB
-
Hi all,
I am developing a plugin that requires the use of a scheduler / cron service in NodeBB via a hook and update plugin-specific list in the DB.
I only need to update this list once a day.
I looked everywhere but I could not find a hook that facilitates this function.
I was wondering whether I've missed something or if there is a different way to do it.
Thanks in advance!
-
We don't have a hook that fires every day, so you will have to create a cron in your plugin. Take a look at https://github.com/julianlam/nodebb-plugin-archiver/blob/f61abd14f4b47af1f3121d4989b5cba9b2ff458d/index.js#L15-L18.
This plugin runs a cronjob and archives topics. You just need to check
nconf.get('runJobs')
like the plugin so only one of the nodebbs instances run the task and not all.