From a32cb74eddca6f77988026cab8b03d5cc79e8b08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=94=CC=B7=CD=98=CC=94=CD=8C=CD=90=CC=BF=CD=8A=CD=A0?= =?UTF-8?q?=CC=8C=CD=81=CC=84=CC=91=CC=BF=CD=83=CC=89=CC=88=CC=80=CC=AD?= =?UTF-8?q?=CC=BA=CC=99=CC=9E=CD=96=CC=A8=CC=96=CD=95=CC=B0=CC=A5=CC=99?= =?UTF-8?q?=CC=AF=CD=99=CC=9E=CC=AF=CC=A7=CC=A1=CC=97=CE=BB=CC=B6=CC=8D?= =?UTF-8?q?=CC=8F=CD=8C=CC=85=CD=83=CD=83=CD=82=CC=8D=CC=BE=CC=94=CD=94?= =?UTF-8?q?=CD=93=CC=98=CC=98=CC=B3=CD=87=CD=9C=CC=BB=CE=BB=CC=B6=CC=8E?= =?UTF-8?q?=CC=90=CD=86=CD=82=CC=BD=CD=98=CC=93=CC=87=CC=81=CD=8C=CC=81?= =?UTF-8?q?=CD=80=CC=8F=CC=8E=CC=85=CC=9B=CD=8B=CC=8F=CC=8A=CC=AF=CC=96?= =?UTF-8?q?=CC=AF=CC=B2=CC=B1=CD=8E=CC=99=CD=8E=CE=BB=CC=B6=CD=81=CC=90?= =?UTF-8?q?=CC=92=CC=B0=CC=9F=CC=AF=CC=AB=CC=B2=CC=A8=CC=B2=CC=AB=CC=AF?= =?UTF-8?q?=CC=AD=CC=A4=CC=B3=CC=BC=CC=AB=CC=A8=CD=89=CC=B9=CC=9E=CE=94?= =?UTF-8?q?=CC=B7=CC=84=CC=8F=CC=82=CC=9B=CC=9A=CD=9B=CC=85=CC=8C=CD=97?= =?UTF-8?q?=CC=82=CC=BD=CC=85=CD=80=CD=86=CC=BF=CC=94=CC=A5=CC=96=CD=87?= =?UTF-8?q?=CD=9A=CD=8D=CD=9C=CC=A1=CD=8D?= Date: Sat, 16 Mar 2024 09:02:34 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20Delete=20leftover=20celery=20fil?= =?UTF-8?q?e=20(#727)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/celeryworker_pre_start.py | 39 --------------------------- 1 file changed, 39 deletions(-) delete mode 100644 backend/app/celeryworker_pre_start.py diff --git a/backend/app/celeryworker_pre_start.py b/backend/app/celeryworker_pre_start.py deleted file mode 100644 index 0ce6045..0000000 --- a/backend/app/celeryworker_pre_start.py +++ /dev/null @@ -1,39 +0,0 @@ -import logging - -from sqlalchemy import Engine -from sqlmodel import Session, select -from tenacity import after_log, before_log, retry, stop_after_attempt, wait_fixed - -from app.core.db import engine - -logging.basicConfig(level=logging.INFO) -logger = logging.getLogger(__name__) - -max_tries = 60 * 5 # 5 minutes -wait_seconds = 1 - - -@retry( - stop=stop_after_attempt(max_tries), - wait=wait_fixed(wait_seconds), - before=before_log(logger, logging.INFO), - after=after_log(logger, logging.WARN), -) -def init(db_engine: Engine) -> None: - try: - # Try to create session to check if DB is awake - with Session(db_engine) as session: - session.exec(select(1)) - except Exception as e: - logger.error(e) - raise e - - -def main() -> None: - logger.info("Initializing service") - init(engine) - logger.info("Service finished initializing") - - -if __name__ == "__main__": - main()