Terminate current Rails instance from initializer -


i'm writing sanity-checking initializer should kill rails process in event properties not met. safest way abort production server's startup process in way? suppose extreme case running exit, i'm not sure if it's best approach.

running on unicorn if matters.

there 3 ways end ruby process:

  • exit end process status 0 (success).
  • exit! end status 1 (which seems appropriate case), , not run blocks defined using kernel#at_exit (which may or may not desirable you).
  • abort end status 1, , will run kernel#at_exit blocks. can give string sent standard out.

so abort best bet. unless have particular reason not run kernel#at_exit blocks want run them.

since unicorn runs initializers once , forks processes after that, approach should fine.

i'll add i'm guessing doing these checks @ "wrong" level -- if possible should check health of environment outside of context of rails. don't know situation, , realize quickness of solution more valuable elegance. :)


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -