jaumard / sails-hook-schedule

Hook to manage basic cron job for sails application
21 stars 6 forks source link

Task beeing ran only once #2

Closed ImanMh closed 8 years ago

ImanMh commented 8 years ago

Does it work with sails -v 0.11.2 ? My tasks only run for once. I expect it to run every minute.

firstTask: {
  cron: '*/1 * * * *',
  task: function (context, sails) {
   console.log("cron ok");
  },
  context: {}
}

I only see cron ok once. I also tried * * * * * and * * * * * * but none of them did work.

Jean-PhilippeD commented 8 years ago

Hi,

It was running fine for me with v 0.11.4, and for no reason, this morning I have the same issue .... still looking whats's happening

Moreover, why is there a model with this hooks ? My Model is empty, should it be filled with the definition in schedule.js ?

I thinks my bug is due that we are the 1st .... yesterday was the 31th.. something might be wrong with date

It seems to be confirmed: https://github.com/node-schedule/node-schedule/issues/225

ImanMh commented 8 years ago

Hey @Jean-PhilippeD what do you mean by

why is there a model with this hooks ?

jaumard commented 8 years ago

Thanks for the report @ImanMh and @Jean-PhilippeD ok so node-schedule plan to fix this. All we have to do is wait and update dependencies when it's done :)

There a model because "normally" this hook allow you to set some cron task on your database (https://github.com/jaumard/sails-hook-schedule/blob/master/api/models/CronTask.js)

Jean-PhilippeD commented 8 years ago

@jaumard thanks for explanation about the usage of model. I was pretty sure that's why you added the model support, but when I first installed the hook, I was confused because I thought there were a bug because my table was empty ;)

jaumard commented 8 years ago

No problem yeah by default I use all tasks under config but if user want to add cron task directly on database (with blueprint for example) then the module use both. But tasks under config are not added on database :) If I forgot and node-schedule publish there new version let me know a I will update this module.

jaumard commented 8 years ago

I just update dependencies on master, do you have the possibilities to test it before I put it under npm ? I don't have time for now.

Jean-PhilippeD commented 8 years ago

Hi,

Sorry for the delay, I've tested in it in another project with npm install, I don't know if you updated the dependencies, but it works fine !

That's nice for the database storage of cron tasks, I will use it soon so that user can add/update tasks without need of access to the conf file. :)

jaumard commented 8 years ago

Great :) I close this if it's solved