Return a 503 for specific PDO exceptions, alternate mix#4720
Closed
paul-m wants to merge 1 commit into
Closed
Conversation
Contributor
Author
|
Closed in favor of handling this in the controller: #4704 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes [issue#]
Describe your changes
This is another way to do #4704 much more generalized.
\PDOExceptionwith a code of 1203 (too many connections).JsonResponsewith a 503 response code for this exception, and aRetry-Afterheader of our choosing.To see it in action, make a local and modify an API controller method to throw the exception. I suggest
Drupal\dkan_datastore\Controller\AbstractQueryController::queryResource. Throw an exception like this:Now request: https://dkan.ddev.site/api/1/datastore/query/8701d18a-5792-5451-8700-a621bccc5f6e
See a message like this:
Watchdog should show you a message like: "PDOException (code: 1203) AI bots taking over."
QA Steps
Checklist before requesting review
If any of these are left unchecked, please provide an explanation