Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Translate Trilogy syscall errors as conn failed
At GitHub we get a fair number of Trilogy `ETIMEDOUT` errors (for known reasons that we might be able to improve somewhat, but I doubt we'll make them go away entirely). These are very much retryable network errors, so it'd be handy if these `ETIMEDOUT` errors were translated to `ConnectionFailed` instead of `StatementInvalid`, making them `retryable_connection_error`s. https://github.com/rails/rails/blob/ed2bc92b82ddc111150cdf48bb646fd97b3baacb/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb#L1077 We're already translating `ECONNRESET` (via matching on the error message) and `EPIPE` to `ConnectionFailed`. Rather than adding another case, this commit treats all of the Trilogy `SystemCallError` subclasses as `ConnectionFailed`. Unfortunately `Trilogy::TimeoutError` is a subclass of `ETIMEDOUT`, so we have to move the `AdapterTimeout` check into the case statement so we can break out to the `super` call in the case of `Trilogy::TimeoutError` that does have an error code (1205, i.e. lock timeout). Cleaning up the various Trilogy timeout errors is a project for another day. We should be able to simplify this exception translation further once we bump the required Trilogy version to 2.6, but I figured I'd start out with this minimal change that works on Trilogy 2.4 as well.
- Loading branch information