Filip
Filip

Reputation: 105

Meteor setInterval on server side

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?

Upvotes: 0

Views: 2125

Answers (1)

Christian Fritz
Christian Fritz

Reputation: 21364

You need to specify a delay for the interval, e.g., 5 seconds:

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

It's hard to know what the behavior will be without a specified time interval.

Upvotes: 2

Related Questions