|
@@ -178,11 +178,19 @@ def update_threshold(threshold_record_old, threshold_record_new):
|
|
|
continue
|
|
|
# 计算新的阈值
|
|
|
if group_key == 'mean_group':
|
|
|
- threshold_new = \
|
|
|
- float(threshold_old) / threshold_param_old['mean_group'] * threshold_param_new['mean_group']
|
|
|
+ if threshold_param_old['mean_group'] == 0:
|
|
|
+ threshold_new = \
|
|
|
+ float(threshold_old) / 10**(-5) * threshold_param_new['mean_group']
|
|
|
+ else:
|
|
|
+ threshold_new = \
|
|
|
+ float(threshold_old) / threshold_param_old['mean_group'] * threshold_param_new['mean_group']
|
|
|
else:
|
|
|
- threshold_new = \
|
|
|
- float(threshold_old) / threshold_param_old['group'] * threshold_param_new['group']
|
|
|
+ if threshold_param_old['group'] == 0:
|
|
|
+ threshold_new = \
|
|
|
+ float(threshold_old) / 10**(-5) * threshold_param_new['group']
|
|
|
+ else:
|
|
|
+ threshold_new = \
|
|
|
+ float(threshold_old) / threshold_param_old['group'] * threshold_param_new['group']
|
|
|
|
|
|
# 更新redis
|
|
|
redis_helper.set_data_to_redis(key_name=key_name, value=threshold_new, expire_time=2 * 24 * 3600)
|