brandonhilkert / sucker_punch

Sucker Punch is a Ruby asynchronous processing library using concurrent-ruby, heavily influenced by Sidekiq and girl_friday.
MIT License
2.64k stars 114 forks source link

Actors only terminate when app is terminated #66

Closed arikrak closed 10 years ago

arikrak commented 10 years ago

When I run my Rails app locally (on WebBrick), each async action creates an actor that only terminates when the app is terminated. The following message shows up after terminating the app, where n is the number of times a sucker_punch async action was called:

Exiting Terminating n actors... Terminating task: type=:finalizer, meta={:method_name=>:shutdown}, status=:callwait

Is this normal? I'm wondering if this may be connected to some H13 errors I recently started getting on Heroku (unicorn server).

brandonhilkert commented 10 years ago

By default, each Job is a "queue" in loose terms. If not specified, each queue has 2 workers (actors). So assuming, you have 5 jobs and use all of them in the lifetime of the application, 10 actors would have been spun up. If you execute one of the jobs 50 times, 50 workers should NOT be created. The jobs will be added to the queue and the 2 workers within that queue will on those jobs until the queue is empty.

Doesn't sound like you're seeing that behavior?

arikrak commented 10 years ago

Yes, sorry, the number of actors is based on the number of different jobs, I had just run many of them. So I'm not sure what's causing the H13 errors.