I want to run a task every 5 minutes using actionhero
task in node.js, the task that I defined in task folder is as below:
'use strict';
exports.task = {
name: 'scheduleTask',
description: 'Convert Temp Data Into Portal',
frequency: 300000,
queue: 'syncPortal',
run: function (api, params, next) {
api.services.ErpToPortal
.syncInitializeFunctions({})
.then(() => {
return api.services.ErpToPortal
.syncPerson({})
})
.then(() => {
return api.services.ErpToPortal
.syncContractors({})
})
.then((res) => {
next(null, res);
})
.catch(function (err) {
api.log(err, 'error', err);
next(err);
});
}
};
My Problem here is that the task does not start automatically while starting actionhero
api server, am I missing anything here ? as I understood from actionherojs documenation, after defining frequency for a task, by starting actionhero api server, the task should be started automatically.