Skip to content

Commit

Permalink
feat: 支持通过环境变量调整插件进程状态同步周期 (closed TencentBlueKing#2228)
Browse files Browse the repository at this point in the history
  • Loading branch information
ping15 authored and ZhuoZhuoCrayon committed May 15, 2024
1 parent afaac91 commit 4470c4a
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 57 deletions.
2 changes: 1 addition & 1 deletion apps/node_man/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class TimeUnit:
COLLECT_AUTO_TRIGGER_JOB_INTERVAL = 5 * TimeUnit.MINUTE
SYNC_CMDB_CLOUD_AREA_INTERVAL = 10 * TimeUnit.SECOND
SYNC_AGENT_STATUS_TASK_INTERVAL = 10 * TimeUnit.MINUTE
SYNC_PROC_STATUS_TASK_INTERVAL = 20 * TimeUnit.MINUTE
SYNC_PROC_STATUS_TASK_INTERVAL = settings.SYNC_PROC_STATUS_TASK_INTERVAL
SYNC_BIZ_TO_GRAY_SCOPE_LIST_INTERVAL = 30 * TimeUnit.MINUTE

CLEAN_EXPIRED_INFO_INTERVAL = 6 * TimeUnit.HOUR
Expand Down
3 changes: 3 additions & 0 deletions config/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,9 @@
# 并发数
CONCURRENT_NUMBER = int(os.getenv("CONCURRENT_NUMBER", 50) or 50)

# 插件进程状态同步周期
SYNC_PROC_STATUS_TASK_INTERVAL = env.BKAPP_SYNC_PROC_STATUS_TASK_INTERVAL

# 敏感参数
SENSITIVE_PARAMS = ["app_code", "app_secret", "bk_app_code", "bk_app_secret", "auth_info"]

Expand Down
5 changes: 5 additions & 0 deletions env/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
# 提供给权限中心的资源回调地址
"BK_IAM_RESOURCE_API_HOST",
"BK_DOMAIN",
# 插件进程状态同步周期
"BKAPP_SYNC_PROC_STATUS_TASK_INTERVAL",
]

# ===============================================================================
Expand All @@ -75,6 +77,9 @@
BKPAAS_BK_CRYPTO_TYPE = get_type_env(
key="BKPAAS_BK_CRYPTO_TYPE", default=constants.BkCryptoType.CLASSIC.value, _type=str
)
BKAPP_SYNC_PROC_STATUS_TASK_INTERVAL = get_type_env(
key="BKAPP_SYNC_PROC_STATUS_TASK_INTERVAL", default=20 * 60, _type=int
)

# ===============================================================================
# 日志
Expand Down
Loading

0 comments on commit 4470c4a

Please sign in to comment.