开发者

Accessing a particular Rails (Passenger) instance

开发者 https://www.devze.com 2022-12-18 01:13 出处:网络
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

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!


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


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
0

精彩评论

暂无评论...
验证码 换一张
取 消