diff options
| author | root <[email protected]> | 2024-03-26 08:45:22 +0000 |
|---|---|---|
| committer | root <[email protected]> | 2024-03-26 08:45:22 +0000 |
| commit | 2b46ddb9658d3525a6a5f22b14d340774fbb1329 (patch) | |
| tree | ddd55bd2ceaaa357b3d7e50d24b0fdfea4186d84 /shaping/src/shaper_stat.cpp | |
| parent | d2f6b74c4f45174db833245df520dd657eb82f01 (diff) | |
TSG-20113: 当同一个hincrby失败超过5次时,不再进行重新执行,并输出一条ERROR级别的日志
Diffstat (limited to 'shaping/src/shaper_stat.cpp')
| -rw-r--r-- | shaping/src/shaper_stat.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/shaping/src/shaper_stat.cpp b/shaping/src/shaper_stat.cpp index 8b8d2ea..ea385f2 100644 --- a/shaping/src/shaper_stat.cpp +++ b/shaping/src/shaper_stat.cpp @@ -15,6 +15,7 @@ #define SHAPER_STAT_ROW_NAME "traffic_shaping_rule_hits" #define SHAPER_STAT_REFRESH_TIME_US 10000 //10 ms +#define HINCRBY_RETRY_MAX 5 struct shaper_stat_conf { int enable_backgroud_thread; @@ -150,6 +151,12 @@ static void shaper_stat_swarmkv_hincrby_cb(const struct swarmkv_reply *reply, vo if (reply->type != SWARMKV_REPLY_INTEGER) { shaper_global_stat_async_hincrby_failed_inc(&ctx->thread_global_stat); + if (arg->retry_cnt >= HINCRBY_RETRY_MAX) { + LOG_ERROR("%s: shaping stat hincrby failed after retry %d times for profile id %d priority %d, operate queue_len %lld", LOG_TAG_STAT, arg->retry_cnt, arg->profile_id, arg->priority, arg->queue_len); + goto END; + } + + arg->retry_cnt++; arg->start_time_us = curr_time_us; shaper_global_stat_async_invoke_inc(&ctx->thread_global_stat);//hincrby failed, retry shaper_global_stat_hincrby_invoke_inc(&ctx->thread_global_stat); @@ -160,8 +167,8 @@ static void shaper_stat_swarmkv_hincrby_cb(const struct swarmkv_reply *reply, vo return; } +END: free(cb_arg); - return; } |
