简体   繁体   English

流星服务器.remove代码在部署时不起作用

[英]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.setIntervalhttp: 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.

相关问题 Jquery:代码在服务器上部署时不起作用,但在浏览器控制台中运行良好 - Jquery: code doesn't work when deployed on the server but runs fine in the browser console Meteor 删除 function 不适用于集合 - Meteor remove function doesn't work on a Collection 在Tomcat8服务器上部署时,WebSocket应用程序无法正常运行 - WebSocket application doesn't work properly when deployed on Tomcat8 server 为什么在Meteor中不能调用此服务器方法? - Why doesn't calling this server method work in Meteor? 我的代码在Meteor中无法正常工作,但可以在JS小提琴上工作 - My code doesn't work properly in Meteor but works on JS fiddle 部署后,GetcurrentPosition不起作用 - GetcurrentPosition doesn't work once deployed 流星已部署在服务器上,但浏览器显示无法访问该站点 - Meteor deployed on server, but browser says site can't be reached 在Bootstrap模式下代码不起作用 - Code Doesn't Work When on Bootstrap Modal Angular Meteor应用程序可在localhost中运行,但在部署到服务器时会失败 - Angular Meteor app works in localhost but fails when deployed to server 通过Cordova部署时,服务器端流星代码在哪里运行? - Where does serverside meteor code run when deployed via cordova?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM