From 5c4cb58b31f2767e581f46652b352a2aad7c26a5 Mon Sep 17 00:00:00 2001 From: pengshiyu <1940607002@qq.com> Date: Tue, 16 Apr 2024 15:15:08 +0800 Subject: [PATCH] fix --- domain_admin/service/async_task_service.py | 8 +++++--- domain_admin/service/scheduler_service/scheduler_main.py | 1 - 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/domain_admin/service/async_task_service.py b/domain_admin/service/async_task_service.py index a9acd60e66..58fc422a62 100644 --- a/domain_admin/service/async_task_service.py +++ b/domain_admin/service/async_task_service.py @@ -14,6 +14,7 @@ from flask import g from domain_admin.log import logger +from domain_admin.model.base_model import db from domain_admin.model.log_async_task_model import AsyncTaskModel from domain_admin.utils import datetime_util @@ -79,9 +80,10 @@ def done_callback(future): 'update_time': datetime_util.get_datetime(), } - AsyncTaskModel.update(data).where( - AsyncTaskModel.id == async_task_row.id - ).execute() + with db.connection_context(): + AsyncTaskModel.update(data).where( + AsyncTaskModel.id == async_task_row.id + ).execute() # execute ret = submit_task(func, *args, **kwargs) diff --git a/domain_admin/service/scheduler_service/scheduler_main.py b/domain_admin/service/scheduler_service/scheduler_main.py index be3eaeb968..1962c68764 100644 --- a/domain_admin/service/scheduler_service/scheduler_main.py +++ b/domain_admin/service/scheduler_service/scheduler_main.py @@ -91,7 +91,6 @@ def get_monitor_task_next_run_time(): return monitor_task.next_run_time -@db.connection_context() def run_monitor_task(): next_run_time = monitor_service.run_monitor_task()