mirror of
https://github.com/goauthentik/authentik
synced 2026-04-25 17:15:26 +02:00
packages/django-dramatiq-postgres: reset db connections in raise_connection_error (#21577)
Co-authored-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
committed by
GitHub
parent
8327b4d177
commit
bbd0cb2521
@@ -62,6 +62,10 @@ def raise_connection_error(func: Callable[P, R]) -> Callable[P, R]: # noqa: UP0
|
|||||||
return func(*args, **kwargs)
|
return func(*args, **kwargs)
|
||||||
except DATABASE_ERRORS as exc:
|
except DATABASE_ERRORS as exc:
|
||||||
logger.warning("Database error encountered", exc=exc)
|
logger.warning("Database error encountered", exc=exc)
|
||||||
|
try:
|
||||||
|
connections.close_all()
|
||||||
|
except DATABASE_ERRORS:
|
||||||
|
pass
|
||||||
raise ConnectionError(str(exc)) from exc # type: ignore[no-untyped-call]
|
raise ConnectionError(str(exc)) from exc # type: ignore[no-untyped-call]
|
||||||
|
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|||||||
Reference in New Issue
Block a user