From 849af21855134511de91cbc02c2ecdd5260cb893 Mon Sep 17 00:00:00 2001 From: simontigers <47096077+simontigers@users.noreply.github.com> Date: Thu, 25 Jan 2024 17:39:52 +0800 Subject: [PATCH] fix: change common_setting task queue (#390) --- cmdb-api/api/lib/common_setting/employee.py | 8 ++++---- cmdb-api/api/tasks/common_setting.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmdb-api/api/lib/common_setting/employee.py b/cmdb-api/api/lib/common_setting/employee.py index 2836919..c543b2b 100644 --- a/cmdb-api/api/lib/common_setting/employee.py +++ b/cmdb-api/api/lib/common_setting/employee.py @@ -16,7 +16,7 @@ from wtforms import validators from api.extensions import db from api.lib.common_setting.acl import ACLManager from api.lib.common_setting.const import OperatorType -from api.lib.cmdb.const import CMDB_QUEUE +from api.lib.perm.acl.const import ACL_QUEUE from api.lib.common_setting.resp_format import ErrFormat from api.models.common_setting import Employee, Department @@ -141,7 +141,7 @@ class EmployeeCRUD(object): def add(**kwargs): try: res = CreateEmployee().create_single(**kwargs) - refresh_employee_acl_info.apply_async(args=(), queue=CMDB_QUEUE) + refresh_employee_acl_info.apply_async(args=(), queue=ACL_QUEUE) return res except Exception as e: abort(400, str(e)) @@ -171,7 +171,7 @@ class EmployeeCRUD(object): if len(e_list) > 0: edit_employee_department_in_acl.apply_async( args=(e_list, new_department_id, current_user.uid), - queue=CMDB_QUEUE + queue=ACL_QUEUE ) return existed @@ -577,7 +577,7 @@ class EmployeeCRUD(object): @staticmethod def import_employee(employee_list): res = CreateEmployee().batch_create(employee_list) - refresh_employee_acl_info.apply_async(args=(), queue=CMDB_QUEUE) + refresh_employee_acl_info.apply_async(args=(), queue=ACL_QUEUE) return res @staticmethod diff --git a/cmdb-api/api/tasks/common_setting.py b/cmdb-api/api/tasks/common_setting.py index efb2c03..c1c560e 100644 --- a/cmdb-api/api/tasks/common_setting.py +++ b/cmdb-api/api/tasks/common_setting.py @@ -3,14 +3,14 @@ from flask import current_app from api.extensions import celery from api.lib.common_setting.acl import ACLManager -from api.lib.cmdb.const import CMDB_QUEUE +from api.lib.perm.acl.const import ACL_QUEUE from api.lib.common_setting.resp_format import ErrFormat from api.models.common_setting import Department, Employee from api.lib.decorator import flush_db from api.lib.decorator import reconnect_db -@celery.task(name="common_setting.edit_employee_department_in_acl", queue=CMDB_QUEUE) +@celery.task(name="common_setting.edit_employee_department_in_acl", queue=ACL_QUEUE) @flush_db @reconnect_db def edit_employee_department_in_acl(e_list, new_d_id, op_uid): @@ -77,7 +77,7 @@ def edit_employee_department_in_acl(e_list, new_d_id, op_uid): return result -@celery.task(name="common_setting.refresh_employee_acl_info", queue=CMDB_QUEUE) +@celery.task(name="common_setting.refresh_employee_acl_info", queue=ACL_QUEUE) @flush_db @reconnect_db def refresh_employee_acl_info():