on_async_exit for subscriber called when async publisher is done
Hi there,
Awesome gem. Really been enjoying working with it.
Not sure if this is the intended behavior but looking at master/lib/circuitry/processor.rb it seems like the on_exit method is set such that the subscriber's on_async_exit method is called regardless of the publisher or subscriber calling the asynchronous method.
Same seems to be the case for logger and error handler. Am I just misunderstanding something?
The on_exit method is only ever called from within a thread or fork, i.e.:
Also worth mentioning that logger and error_handler are just methods referencing the config. They're not being called unless they're needed.
So I ran this example:
Circuitry.subscriber_config do |c|
...
c.async_strategy = :thread
c.on_async_exit = proc do
Rails.logger.info "subscriber done"
end
...
end
Circuitry.publisher_config do |c|
...
c.async_strategy = :thread
c.on_async_exit = proc do
Rails.logger.info "publisher done"
end
...
end
Circuitry.publish('topic', 'message', async: true, timeout: 20)
My expectation was that it would log "publisher done" but instead I received "subscriber done". Is that the intended behavior?
Ahh, I follow what you're saying now. That is a legit bug. Thank you for the report!