fix: xxx is not bound to a Session (#24966)

This commit is contained in:
Will
2025-09-02 21:37:06 +08:00
committed by GitHub
parent 25a11bfafc
commit b5216df4fe
2 changed files with 5 additions and 2 deletions

View File

@@ -145,7 +145,10 @@ class AccountService:
if naive_utc_now() - account.last_active_at > timedelta(minutes=10):
account.last_active_at = naive_utc_now()
db.session.commit()
# NOTE: make sure account is accessible outside of a db session
# This ensures that it will work correctly after upgrading to Flask version 3.1.2
db.session.refresh(account)
db.session.close()
return account
@staticmethod