We sometimes encounter this error in our production release:
{:error, %Finch.Error{reason: :read_only}}
This error indicates that the checked out pool is close for writing and only able to read responses. If the pool is in :disconnected or :connected_read_only state, it's not able to make requests (I'll refer these two states as not_ready from now on). This problem is worsen if the reconnect process takes longer, eg: when network connections are unstable.
My point is we should be able to filter out not_ready pools while performing lookup. Right now, there's no way to efficiently get pool's current state other than sending a message to it (GenServer.call, :sys.get_state, ...). How about lifting the pool state to an ets table?