@@ -136,7 +136,10 @@ impl State {
136
136
137
137
async fn rav_requester_single ( & mut self ) -> Result < ( ) > {
138
138
let Some ( allocation_id) = self . sender_fee_tracker . get_heaviest_allocation_id ( ) else {
139
- anyhow:: bail!( "Error while getting the heaviest allocation because none has unaggregated fees tracked" ) ;
139
+ anyhow:: bail!(
140
+ "Error while getting the heaviest allocation because \
141
+ no unblocked allocation has enough unaggregated fees tracked"
142
+ ) ;
140
143
} ;
141
144
let sender_allocation_id = self . format_sender_allocation ( & allocation_id) ;
142
145
let allocation = ActorRef :: < SenderAllocationMessage > :: where_is ( sender_allocation_id) ;
@@ -147,7 +150,9 @@ impl State {
147
150
) ;
148
151
} ;
149
152
// we call and wait for the response so we don't process anymore update
150
- let ( fees, rav) = call ! ( allocation, SenderAllocationMessage :: TriggerRAVRequest ) ?;
153
+ let Ok ( ( fees, rav) ) = call ! ( allocation, SenderAllocationMessage :: TriggerRAVRequest ) else {
154
+ anyhow:: bail!( "Error while sending and waiting message for actor {allocation_id}" ) ;
155
+ } ;
151
156
152
157
// update rav tracker
153
158
self . rav_tracker . update (
@@ -470,14 +475,13 @@ impl Actor for SenderAccount {
470
475
trigger_value = state. config. tap. rav_request_trigger_value,
471
476
"Total fee greater than the trigger value. Triggering RAV request"
472
477
) ;
473
- // There are only 3 scenarios where this can fail:
474
- // - No allocation ids
475
- // - The SenderAllocation could not be found
476
- // - The SenderAllocation could not process the message
477
- // In any case, we want to respawn this whole actor
478
- // and respawn all its children actors. Thus, we can safely
479
- // panic the actor by using ?
480
- state. rav_requester_single ( ) . await ?;
478
+ // In case we fail, we want our actor to keep running
479
+ if let Err ( err) = state. rav_requester_single ( ) . await {
480
+ tracing:: error!(
481
+ error = %err,
482
+ "There was an error while requesting a RAV."
483
+ ) ;
484
+ }
481
485
}
482
486
483
487
// Maybe allow the sender right after the potential RAV request. This way, the
@@ -502,6 +506,9 @@ impl Actor for SenderAccount {
502
506
state. format_sender_allocation ( allocation_id) ,
503
507
) {
504
508
tracing:: trace!( %allocation_id, "SenderAccount shutting down SenderAllocation" ) ;
509
+ // we can not send a rav request to this allocation
510
+ // because it's gonna trigger the last rav
511
+ state. sender_fee_tracker . block_allocation_id ( * allocation_id) ;
505
512
sender_handle. stop ( None ) ;
506
513
}
507
514
}
@@ -594,6 +601,10 @@ impl Actor for SenderAccount {
594
601
595
602
let tracker = & mut state. sender_fee_tracker ;
596
603
tracker. update ( allocation_id, 0 ) ;
604
+ // clean up hashset
605
+ state
606
+ . sender_fee_tracker
607
+ . unblock_allocation_id ( allocation_id) ;
597
608
// rav tracker is not updated because it's still not redeemed
598
609
}
599
610
SupervisionEvent :: ActorPanicked ( cell, error) => {
0 commit comments