instacart / makara

A Read-Write Proxy for Connections; Also provides an ActiveRecord adapter.
http://tech.taskrabbit.com/
MIT License
929 stars 170 forks source link

Early check connection blacklisting #277

Closed arizz96 closed 1 year ago

arizz96 commented 3 years ago

With these changes I want to fix the problem described in https://github.com/instacart/makara/issues/258 where lot of connection attempts are performed when primary/replica DBs configuration isn't usable.

I found that _makara_connection method tries to establish connection everytime it's called when @connection is nil, also when blacklisted. I added an early check on blacklisting status.

I also added some unit tests for this method.