[英]Meteor server .remove code doesn't work when deployed
I have some code that cleans out elements in a loop when they are no longer needed running on the server: 我有一些代码可以在不再需要在服务器上运行时清除循环中的元素:
setInterval(serverLoop, 1000);
function serverLoop() {
Fiber(function() {
Blocks.remove({type: "hit"});
Letters.remove({timeout: {$lte: 0}});
}).run();
}
The code works on localhost:3000, but when I deploy to meteor.com, the .remove does not work. 该代码在localhost:3000上有效,但是当我部署到meteor.com时,.remove不起作用。 Am I missing something here?
我在这里想念什么吗?
Why not use Meteor.setInterval
, http://docs.meteor.com/#meteor_setinterval instead? 为什么不使用
Meteor.setInterval
, http: Meteor.setInterval
呢?
Meteor.setInterval(serverLoop, 1000);
function serverLoop() {
Blocks.remove({type: "hit"});
Letters.remove({timeout: {$lte: 0}});
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.