sailsjs with laterjs for scheduling task.

30 views
Skip to first unread message

Lianboi Thomte

unread,
Feb 10, 2016, 10:03:24 AM2/10/16
to sails.js
I am trying to implement laterjs on top of sailsjs. in the bootstrap.js file, I add 
sails.services.taskschedule.schedulepush();
before 
cb();
 and my api/services/taskschedule.js expose schedulepush() , i require 'later' in this file.

the problem is
var schedule = later.parse.text('every 5 min');
var lt = later.setInterval(somfunction, schedule) ;

inside the schedulepush() is executed immediately and only once while I suppose it should run every 5 minutes.
also, console.log(lt) is undefined.

what could the problem be? and  How can it be fixed?

Cory Robinson

unread,
Feb 10, 2016, 10:57:56 AM2/10/16
to Lianboi Thomte, sails.js
Have you tried running laterejs with your code in a simple page wrapper to ensure the library is working as expected? We can’t be sure it’s and issue with sails unless you give a little more description and possibly a gist with some code.

Lianboi Thomte

unread,
Feb 10, 2016, 2:58:40 PM2/10/16
to sails.js, lianboi...@technocube.in
After testing with a bare minimun sails app, I found out that the problem still remains while node-scheduler runs ok. It must be the laterjs problem. So, I guess I'll just leave it here for now.
Reply all
Reply to author
Forward
0 new messages