Reactive cursor not based on data change but on data calculation


Here is my object :

Room = {
   id : A32,
   availability : {
       from: 5pm,
       to: 6pm

I have the following publication :

Meteor.publish('availableRooms', function(){

I want to make this publication reactive but based on the availability of the room.
I tought of a periodic job that republish each 1 minute to all clients (which is not performant I think. I have more than 2000 rooms with more data).

How do you handle this kind of reactivity ?


I would start by taking a look at synced-cron.

Without knowing exactly what your use case is I would imagine that you will need to allow for an initial population of the job list, together with occasional updates to rooms and/or times. Each room will need a “from time” job and a “to time” job. As you suggest, you should definitely move away from using MongoDB as a job queue runner.