File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ use tokio::task::JoinHandle;
2222
2323const TOTAL_RECOVERY_FAIL_MAX_MSGS_ENV : & str = "TOTAL_RECOVERY_FAIL_MAX_MSGS" ;
2424const TOTAL_RECOVERY_FAIL_MAX_MSGS_DEFAULT : & str = "75" ;
25+ const TOTAL_RECOVERY_FAIL_TOP_LAYER_MAX_MSGS_ENV : & str = "TOTAL_RECOVERY_FAIL_TOP_LAYER_MAX_MSGS" ;
26+ const TOTAL_RECOVERY_FAIL_TOP_LAYER_MAX_MSGS_DEFAULT : & str = "500" ;
2527
2628pub async fn process_expired_epoch (
2729 conn : Arc < Mutex < DBConnection > > ,
@@ -221,12 +223,18 @@ fn process_one_layer(
221223 hex:: encode( msg_tag) ,
222224 hex:: encode( chunk. parent_msg_tag. clone( ) . unwrap_or_default( ) ) ,
223225 ) ;
224- if threshold_msgs_len
225- <= parse_env_var :: < usize > (
226+ let failure_max_threshold = match chunk . parent_msg_tag . is_some ( ) {
227+ true => parse_env_var :: < usize > (
226228 TOTAL_RECOVERY_FAIL_MAX_MSGS_ENV ,
227229 TOTAL_RECOVERY_FAIL_MAX_MSGS_DEFAULT ,
228- )
229- {
230+ ) ,
231+ false => parse_env_var :: < usize > (
232+ TOTAL_RECOVERY_FAIL_TOP_LAYER_MAX_MSGS_ENV ,
233+ TOTAL_RECOVERY_FAIL_TOP_LAYER_MAX_MSGS_DEFAULT ,
234+ ) ,
235+ } ;
236+
237+ if threshold_msgs_len <= failure_max_threshold {
230238 total_error_count += threshold_msgs_len;
231239 continue ;
232240 }
You can’t perform that action at this time.
0 commit comments