Don't treat Kafka connection errors as Makara database errors #243
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We use Kafka alongside Makara in our app, and for some Kafka events we wrap them in a transaction as we want to roll back any changes to the database in case an event doesn't get published.
When event publication fails, a
Kafka::DeliveryFailed - Could not connect to any of the seed brokers
exception is raised:The decription
Could not connect to any of the seed brokers
however ends up catching this and re-raising it as aMakara::Errors::AllConnectionsBlacklisted
exception, due to the line here:https://github.com/taskrabbit/makara/blob/dac6be2e01e0511db6715b2b4da65a5490e01cba/lib/active_record/connection_adapters/makara_abstract_adapter.rb#L23
...causing some difficulties with the way we track and manage exceptions.
This PR rather naively removes
could not connect
from the list ofCONNECTION_MATCHERS
, since all specs still seem to pass, but I'm not sure if there is something I'm unaware of! 🙇The two errors that could have been affected, are actually caught thanks to the presence of
connection refused
in their descriptions:https://github.com/taskrabbit/makara/blob/d609178c3ae278ba377efa2bbdaf10e4f4d71b6a/spec/active_record/connection_adapters/makara_abstract_adapter_error_handling_spec.rb#L37
https://github.com/taskrabbit/makara/blob/d609178c3ae278ba377efa2bbdaf10e4f4d71b6a/spec/active_record/connection_adapters/makara_abstract_adapter_error_handling_spec.rb#L41
Let me know if I've got the wrong end of the stick! 🙏