Completion Hook for Rails

I want some kind of cleanup code to run when Rails closes - is this possible? My situation is that I have several threads in the background (I use jruby and call in java) that live for the life of the process, and I need to tell them to close them.

Thanks!

+7
source share
1 answer

You probably just need to use the Ruby exit handler, which is the kernel method:

$ irb >> at_exit do ?> puts 'bye...' >> end => #<Proc: 0xb79a87e4@ (irb):1> >> exit bye... $ 
+15
source

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


All Articles