Skip to content

Instantly share code, notes, and snippets.

@vitobotta
Created January 9, 2021 19:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vitobotta/89e86bddd88d8d0de2e80f3f29621e46 to your computer and use it in GitHub Desktop.
Save vitobotta/89e86bddd88d8d0de2e80f3f29621e46 to your computer and use it in GitHub Desktop.
module ActiveSupport
module Testing
class Parallelization # :nodoc:
class Worker
def start
fork do
set_process_title("(starting)")
DRb.stop_service
@queue = DRbObject.new_with_uri(@url)
@queue.start_worker(@id)
begin
Spring.after_fork do
after_fork
end
rescue => @setup_exception; end
work_from_queue
ensure
set_process_title("(stopping)")
run_cleanup
@queue.stop_worker(@id)
end
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment