mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix: sqlalchemy sessions per request
Best practice for web-apps is to have a session per web request. Instead of having a per worker-thread, we add a middleware that generates a unique ID per request, utilizing scoped_sessions scopefunc (custom function for defining a session scope) in combination with a ContextVar. With this we create a new session per request. Signed-off-by: moson <moson@archlinux.org>
This commit is contained in:
parent
db004d5ebd
commit
c0dc507e4f
8 changed files with 94 additions and 19 deletions
|
@ -768,6 +768,7 @@ def test_pm_proposal_vote(client, proposal):
|
|||
assert response.status_code == int(HTTPStatus.OK)
|
||||
|
||||
# Check that the proposal record got updated.
|
||||
db.refresh(voteinfo)
|
||||
assert voteinfo.Yes == yes + 1
|
||||
|
||||
# Check that the new PMVote exists.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue