File tree 1 file changed +10
-6
lines changed
bridges/centralized-ethereum/src/actors
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -105,23 +105,27 @@ impl EthPoller {
105
105
106
106
let last_dr_id = dr_database_addr. send ( GetLastDrId ) . await ;
107
107
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) {
109
109
if last_dr_id < skip_first {
110
110
log:: debug!(
111
111
"Skipping first {} queries as per SKIP_FIRST config param" ,
112
112
skip_first
113
113
) ;
114
114
last_dr_id = skip_first;
115
115
}
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 {
120
117
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
+ } ;
122
124
let ids = init_index..last_index;
123
125
let ids: Vec < Token > = ids. map ( |id| Token :: Uint ( id. into ( ) ) ) . collect ( ) ;
124
126
127
+ last_dr_id += U256 :: from ( max_batch_size) ;
128
+
125
129
let queries_status: Result < Vec < Token > , web3:: contract:: Error > = wrb_contract
126
130
. query (
127
131
"getQueryStatusBatch" ,
You can’t perform that action at this time.
0 commit comments