-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(db) store connection in request-aware context
Calling `db:connect()` used to store the connection in as an instance attribute in `self`, therefore in a worker singleton (`kong.db`), which would produce `bad request` errors when used at runtime (i.e. non-migration contexts). This error presents itself when within the `plugins:select_by_cache_key` special DAO method, in which the schema_state module performs a `connect()` and subsequent operations to determine the database schema state. Storing the connection object in the request aware context (`ngx.ctx`) prevents this issue. We still store the connection as an instance attribute in non-request contexts. From Kong#4081
- Loading branch information
1 parent
4ef9df5
commit b9f2ba8
Showing
4 changed files
with
141 additions
and
68 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.