File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
bridges/centralized-ethereum/src/actors Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -105,23 +105,27 @@ impl EthPoller {
105105
106106 let last_dr_id = dr_database_addr. send ( GetLastDrId ) . await ;
107107
108- if let ( Ok ( mut next_dr_id) , Ok ( Ok ( mut last_dr_id) ) ) = ( next_dr_id, last_dr_id) {
108+ if let ( Ok ( next_dr_id) , Ok ( Ok ( mut last_dr_id) ) ) = ( next_dr_id, last_dr_id) {
109109 if last_dr_id < skip_first {
110110 log:: debug!(
111111 "Skipping first {} queries as per SKIP_FIRST config param" ,
112112 skip_first
113113 ) ;
114114 last_dr_id = skip_first;
115115 }
116- if last_dr_id < next_dr_id {
117- if next_dr_id > last_dr_id + max_batch_size {
118- next_dr_id = last_dr_id + max_batch_size;
119- }
116+ while last_dr_id < next_dr_id {
120117 let init_index = usize:: try_from ( last_dr_id + 1 ) . unwrap ( ) ;
121- let last_index = usize:: try_from ( next_dr_id) . unwrap ( ) ;
118+ let last_index = match next_dr_id. cmp ( & ( last_dr_id + max_batch_size) ) {
119+ std:: cmp:: Ordering :: Greater => {
120+ usize:: try_from ( last_dr_id + max_batch_size) . unwrap ( )
121+ }
122+ _ => usize:: try_from ( next_dr_id) . unwrap ( ) ,
123+ } ;
122124 let ids = init_index..last_index;
123125 let ids: Vec < Token > = ids. map ( |id| Token :: Uint ( id. into ( ) ) ) . collect ( ) ;
124126
127+ last_dr_id += U256 :: from ( max_batch_size) ;
128+
125129 let queries_status: Result < Vec < Token > , web3:: contract:: Error > = wrb_contract
126130 . query (
127131 "getQueryStatusBatch" ,
You can’t perform that action at this time.
0 commit comments