1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

update embed example, shouldnt need require

This commit is contained in:
Mike Perham 2022-10-31 10:27:57 -07:00
parent 8a1e33fc1a
commit 550206f68f
No known key found for this signature in database

View file

@ -36,23 +36,22 @@ workers ENV.fetch("WEB_CONCURRENCY", 2)
# This directive tells Puma to first boot the application and load code # This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write # before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory. # process behavior so workers use less memory.
#
require "sidekiq"
preload_app! preload_app!
# Allow puma to be restarted by `bin/rails restart` command. # Allow puma to be restarted by `bin/rails restart` command.
plugin :tmp_restart plugin :tmp_restart
x = nil
on_worker_boot do on_worker_boot do
$sidekiq = Sidekiq.configure_embed do |config| x = Sidekiq.configure_embed do |config|
config.queues = %w[critical default low] config.queues = %w[critical default low]
# don't raise this unless you know your app has available CPU time to burn. # don't raise this unless you know your app has available CPU time to burn.
# it's easy to overload a Ruby process with too many threads. # it's easy to overload a Ruby process with too many threads.
config.concurrency = 2 config.concurrency = 2
end end
$sidekiq&.run x&.run
end end
on_worker_shutdown do on_worker_shutdown do
$sidekiq&.stop x&.stop
end end