Background tasks in Meteor

前端 未结 4 1768
自闭症患者
自闭症患者 2020-11-27 09:40

I\'m wondering, is there is way to implement background taks, maybe with workers pool. Can you show me direction, i\'m thinking about writing package for this?

4条回答
  •  清歌不尽
    2020-11-27 10:25

    There is a package based on Cron jobs which can be used to schedule tasks on certain intervals or dates. Here is the package: https://atmosphere.meteor.com/package/cron

    And if you happen to look into the source of that package, you'll notice they're simply using:

    Meteor.setInterval( ... , delay );

    So if you save your tasks in a database, then load them into intervals during startup, then you'll probably be on the right track.

提交回复
热议问题