Stopping cached subscriptions during live-reload


#1

I like to cache my subscriptions using a setTimeout. When I no longer need a subscriptions I do something like

id = Meteor.setTimeout(function() {
  sub.stop()
}, 1000*60*2)

which will cache the subscription for 2 minutes before stopping it. But if I some back to the same page to resubscribe, I can just cancel the timeout Meteor.clearTimeout(id). This works great. But when I call Meteor._reload.reload(), the timeouts are forgotten and now I have some subscriptions that will live on forever.

Any ideas how to clear these subscriptions on live-reloads?


#2

well, store list of them somewhere and handle it in some of these Meteor._reload hooks.
Reminds me of Flux Example App with React & Meteor


#4

Maybe you can check those packages to see if they got a solution:



#5

yeah, i built subs-cache :wink: