Skip to content

Commit

Permalink
Better handle RDS restarts by setting pool_pre_ping arg to sqlalchemy.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathangreen committed Feb 21, 2024
1 parent 1be90db commit 2c157ed
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,9 @@ class SessionManager:
@classmethod
def engine(cls, url=None):
url = url or Configuration.database_url()
return create_engine(url, echo=DEBUG, json_serializer=json_serializer)
return create_engine(
url, echo=DEBUG, json_serializer=json_serializer, pool_pre_ping=True
)

@classmethod
def setup_event_listener(
Expand Down

0 comments on commit 2c157ed

Please sign in to comment.