Meteor setInterval on server side


#1

What have I do, to use Meteor.setInterval on server side? When I use it, it’s work, but I get:

Exception in setInterval callback: Error: Method not found [404] 
I20150429-15:47:50.897(2)?  at [object Object]._.extend.apply (packages/ddp/livedata_server.js:1502:1) 
I20150429-15:47:50.897(2)?    at [object Object]._.extend.call 
(packages/ddp/livedata_server.js:1472:1) 
I20150429-15:47:50.897(2)?   
 at app/server/cronJob.js:35:43 
I20150429-15:47:50.897(2)?    
 at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
 I20150429-15:47:50.897(2)?   at packages/meteor/timers.js:6:1 
I20150429-15:47:50.898(2)? at runWithEnvironment
(packages/meteor/dynamics_nodejs.js:108:1)

I get this error even then I try this:

Meteor.setInterval(function(){
console.log("test");
});

Why it happens?


#2

Your example is missing an interval:

Meteor.setInterval(function(){
  console.log("test");
}, 1000);

To set a 1 second interval, for example.


#3

The error is about your cron job app/server/cronJob.js line 35 :wink: