mirror of https://github.com/veops/cmdb.git
fix: change common_setting task queue (#390)
This commit is contained in:
parent
861564c0da
commit
849af21855
|
@ -16,7 +16,7 @@ from wtforms import validators
|
||||||
from api.extensions import db
|
from api.extensions import db
|
||||||
from api.lib.common_setting.acl import ACLManager
|
from api.lib.common_setting.acl import ACLManager
|
||||||
from api.lib.common_setting.const import OperatorType
|
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.lib.common_setting.resp_format import ErrFormat
|
||||||
from api.models.common_setting import Employee, Department
|
from api.models.common_setting import Employee, Department
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ class EmployeeCRUD(object):
|
||||||
def add(**kwargs):
|
def add(**kwargs):
|
||||||
try:
|
try:
|
||||||
res = CreateEmployee().create_single(**kwargs)
|
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
|
return res
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
abort(400, str(e))
|
abort(400, str(e))
|
||||||
|
@ -171,7 +171,7 @@ class EmployeeCRUD(object):
|
||||||
if len(e_list) > 0:
|
if len(e_list) > 0:
|
||||||
edit_employee_department_in_acl.apply_async(
|
edit_employee_department_in_acl.apply_async(
|
||||||
args=(e_list, new_department_id, current_user.uid),
|
args=(e_list, new_department_id, current_user.uid),
|
||||||
queue=CMDB_QUEUE
|
queue=ACL_QUEUE
|
||||||
)
|
)
|
||||||
|
|
||||||
return existed
|
return existed
|
||||||
|
@ -577,7 +577,7 @@ class EmployeeCRUD(object):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def import_employee(employee_list):
|
def import_employee(employee_list):
|
||||||
res = CreateEmployee().batch_create(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
|
return res
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
@ -3,14 +3,14 @@ from flask import current_app
|
||||||
|
|
||||||
from api.extensions import celery
|
from api.extensions import celery
|
||||||
from api.lib.common_setting.acl import ACLManager
|
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.lib.common_setting.resp_format import ErrFormat
|
||||||
from api.models.common_setting import Department, Employee
|
from api.models.common_setting import Department, Employee
|
||||||
from api.lib.decorator import flush_db
|
from api.lib.decorator import flush_db
|
||||||
from api.lib.decorator import reconnect_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
|
@flush_db
|
||||||
@reconnect_db
|
@reconnect_db
|
||||||
def edit_employee_department_in_acl(e_list, new_d_id, op_uid):
|
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
|
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
|
@flush_db
|
||||||
@reconnect_db
|
@reconnect_db
|
||||||
def refresh_employee_acl_info():
|
def refresh_employee_acl_info():
|
||||||
|
|
Loading…
Reference in New Issue