giraffi / fluent-plugin-amqp

Use AMQP broker to send or receive messages via FluentD
MIT License
15 stars 31 forks source link

Fix for NoMethodError: undefined method `emit' for nil:NilClass error… #45

Open hugegreenbug opened 7 years ago

hugegreenbug commented 7 years ago

Fix for NoMethodError: undefined method `emit' for nil:NilClass errors with bunny 2.6.4 when exiting fluentd

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-0.2%) to 91.398% when pulling 3802dea7cba3b403f1375a462ee5e037ccc34420 on hugegreenbug:master into b1f9355c1c2e3dceb250668b8011cac314890c1f on giraffi:master.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-0.2%) to 91.398% when pulling 3802dea7cba3b403f1375a462ee5e037ccc34420 on hugegreenbug:master into b1f9355c1c2e3dceb250668b8011cac314890c1f on giraffi:master.

warmfusion commented 7 years ago

Should we perhaps unsubscribe explicitly in the shutdown method so that the block is terminated cleanly.

Or at least return before parsing the payload to save CPU cycles?

Do you always see this error ?

warmfusion commented 7 years ago

I'm concerned that this implementation will result in message loss during shutdown as the message will have been consumed off the broker, and as we dont use ack'd message handling if the router.nil? is fired it'd silently drop the event (andperhaps others if there are other circumstances where router is nil...

Perhaps shutting down the broker connection before the router can become nil, or implementing a brief nack/ack handler for the router.emit might be solve that?