Skip to content

Commit

Permalink
adding pool_recycle for mysql to avoid 'server has gone away' error
Browse files Browse the repository at this point in the history
  • Loading branch information
niquerio committed Nov 11, 2024
1 parent f863481 commit 7029fe4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion aim/digifeeds/database/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
if S.ci_on: # pragma: no cover
engine = create_engine(S.test_database)
else: # pragma: no cover
engine = create_engine(S.mysql_database)
engine = create_engine(S.mysql_database, pool_recycle=3600)

SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)

Expand Down Expand Up @@ -112,6 +112,7 @@ def create_item(
db_item = crud.add_item(item=item, db=db)
return db_item


desc_put_404 = """
Bad request: The item or status doesn't exist<br><br>
Possible reponses:
Expand All @@ -121,6 +122,7 @@ def create_item(
</ul>
"""


@app.put(
"/items/{barcode}/status/{status_name}",
response_model_by_alias=False,
Expand Down

0 comments on commit 7029fe4

Please sign in to comment.