Meteor Instance ID

#1

hi,

I needed to integrate a parameter in my meteor application that allows me to clean up certain caching systems inside my application every time the meteor instance is restarted.
(my case study here: https://github.com/Keplerjs/Kepler/issues/74)

already there is a global variable in meteor that is generated uniquely for each instance?

Or should I generate a random variable in Meteor.startup ???

many tnks,
Stefano

#2

I think that’s the way to go. Obviously, if you use multiple server instances in an application, there will be an ID for each.

1 Like
#3

This package was designed specifically for that purpose… https://atmospherejs.com/socialize/server-presence

2 Likes
#4

Great very interesting, can I use this? and it works with multiple instances?

ServerPresence.serverId()
#5

Of course you can, and yes the package was designed as a way to run server specific cleanup tasks when a server goes down.

If you are doing cleanup, and don’t need the serverId for some other reason. There is the ServerPresence.onCleanup method to register a callback to run when your app exits.

1 Like