Bruno Antunes
Bruno Antunes

Reputation: 2262

Accessing a particular Rails (Passenger) instance

I have this Rails app that can be spawned (by Passenger) a number of times. I want to generate a random id for each instance and include it in every view (as a comment on the HTML output), and be able to access a specific instance using the id.

Is this possible with Passenger? Can I target a specific instance? I want to be able to run /reload, for example, on one of them.

Thanks for any help!

Upvotes: 1

Views: 176

Answers (2)

Hongli
Hongli

Reputation: 18944

With 2.2 you can't. However 3.0 will probably have such a feature. Watch our blog for news.

Upvotes: 2

tadman
tadman

Reputation: 211690

One thing that might work, which is moderately random, is the process ID number. On most systems these will count up gradually over time, then repeat eventually. For example in ERB:

<!-- Passenger #<%= $$ %> -->

That way if you need to restart that particular process, you can just kill it from the command-line. For example, if it said "Passenger #12040":

% kill 12040

Upvotes: 2

Related Questions