Skip to content

Commit

Permalink
update embed example, shouldnt need require
Browse files Browse the repository at this point in the history
  • Loading branch information
mperham committed Oct 31, 2022
1 parent 8a1e33f commit 550206f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions myapp/config/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,22 @@
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory.
#
require "sidekiq"
preload_app!

# Allow puma to be restarted by `bin/rails restart` command.
plugin :tmp_restart

x = nil
on_worker_boot do
$sidekiq = Sidekiq.configure_embed do |config|
x = Sidekiq.configure_embed do |config|
config.queues = %w[critical default low]
# 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.
config.concurrency = 2
end
$sidekiq&.run
x&.run
end

on_worker_shutdown do
$sidekiq&.stop
x&.stop
end

0 comments on commit 550206f

Please sign in to comment.