Browse Source

ad_threshold_auto_update opt

liqian 1 year ago
parent
commit
9311940c6c
1 changed files with 3 additions and 0 deletions
  1. 3 0
      ad_threshold_auto_update.py

+ 3 - 0
ad_threshold_auto_update.py

@@ -176,6 +176,9 @@ def update_threshold(threshold_record_old, threshold_record_new):
                     threshold_old = redis_helper.get_data_from_redis(key_name=key_name)
                     threshold_old = redis_helper.get_data_from_redis(key_name=key_name)
                     if threshold_old is None:
                     if threshold_old is None:
                         continue
                         continue
+                    # 原阈值为0时,加10**(-5)兜底处理
+                    if float(threshold_old) == 0:
+                        threshold_old = float(threshold_old) + 10**(-5)
                     # 计算新的阈值
                     # 计算新的阈值
                     if group_key == 'mean_group':
                     if group_key == 'mean_group':
                         if threshold_param_old['mean_group'] == 0:
                         if threshold_param_old['mean_group'] == 0: