簡體   English   中英

流星服務器.remove代碼在部署時不起作用

[英]Meteor server .remove code doesn't work when deployed

我有一些代碼可以在不再需要在服務器上運行時清除循環中的元素:

setInterval(serverLoop, 1000);

function serverLoop() {
  Fiber(function() {
    Blocks.remove({type: "hit"});
    Letters.remove({timeout: {$lte: 0}});
  }).run();
}

該代碼在localhost:3000上有效,但是當我部署到meteor.com時,.remove不起作用。 我在這里想念什么嗎?

為什么不使用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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM