Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error raised when handler doesn't exist #35042

Merged
merged 1 commit into from Jan 25, 2019

Conversation

Projects
None yet
2 participants
@eileencodes
Copy link
Member

eileencodes commented Jan 24, 2019

While working on another feature for multiple databases (auto-switching)
I observed that in development the first request won't autoload the
application record connection for the primary database and may not yet
know about the replica connection.

In my test application this caused the application to thrown an error if
I tried to send the first request to the replica before the replica was
connected. This wouldn't be an issue in production because the
application is preloaded.

In order to fix this I decided to leave the original error message and
delete the new error message. I updated the original error message to
include the role to make it a bit clearer that the connection isn't
established for that particular role.

The error now reads:

No connection pool with 'primary' found for the 'reading' role.

cc/ @tenderlove @rafaelfranca @matthewd

@eileencodes eileencodes added this to the 6.0.0 milestone Jan 24, 2019

Fix error raised when handler doesn't exist
While working on another feature for multiple databases (auto-switching)
I observed that in development the first request won't autoload the
application record connection for the primary database and may not yet
know about the replica connection.

In my test application this caused the application to thrown an error if
I tried to send the first request to the replica before the replica was
connected. This wouldn't be an issue in production because the
application is preloaded.

In order to fix this I decided to leave the original error message and
delete the new error message. I updated the original error message to
include the `role` to make it a bit clearer that the connection isn't
established for that particular role.

The error now reads:

```
No connection pool with 'primary' found for the 'reading' role.
```

A single database application will continue uisng the original error
message:

```
No connection pool with 'primary' found.
```

@eileencodes eileencodes force-pushed the eileencodes:fix-error-message-for-missing-handler branch from 87331ea to 1284f82 Jan 25, 2019

@eileencodes

This comment has been minimized.

Copy link
Member Author

eileencodes commented Jan 25, 2019

Ended up checking if this was a multi db application by seeing if the handler was equivalent to the default handler and then using the original error message for a single db application since the role isn't applicable in a single db app.

@eileencodes eileencodes merged commit bf3a8a0 into rails:master Jan 25, 2019

2 checks passed

codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@eileencodes eileencodes deleted the eileencodes:fix-error-message-for-missing-handler branch Jan 25, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.