End current Rails instance from initializer

I am writing a health check initializer that should kill the Rails process if certain properties fail. What would be the safest way to interrupt the production server startup process this way? I believe the extreme case works exit, but I'm not sure if this is the best approach.

Running it on a unicorn, if that matters.

+4
source share
1 answer

There are three ways to complete the ruby ​​process:

  • exit completes the process with status 0 (success).
  • exit! 1 ( ), , Kernel#at_exit ( ).
  • abort 1 Kernel#at_exit. , ​​ .

, abort, , . Kernel#at_exit, , , .

, , .

, , "" - , . , , , .:)

+3

Source: https://habr.com/ru/post/1525529/


All Articles