Getting info from the monitored process
I am using god to monitor my delayed jobs. currently I suffer from exceeded memory consumption from time to time, I've set god to restart jobs exceeding 100MB. my question is: is there a way to get information from the current running job before god restarts it? this is crucial in order to know what process exactly causes the exceeded memory consumption
Thanks, 开发者_JAVA百科 Ran
You need to create a custom behavior. There are several examples in the source for god. In general, in behavior.rb you can see there is a function called before_restart() that you will need to replace with your custom logic when you subclass the Behavior class. You will then need to add some code like w.behavior(:your_new_behavior)
to your god config.
Note: I have not personally done this, but looking threw the code it looks like the way to go.
精彩评论