File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -891,10 +891,17 @@ impl Batcher {
891891 debug ! ( "User state for address {addr:?} not found, creating a new one" ) ;
892892 // We add a dummy user state to grab a lock on the user state
893893 let dummy_user_state = UserState :: new ( ethereum_user_nonce) ;
894- self . user_states
895- . write ( )
896- . await
897- . insert ( addr, Arc :: new ( Mutex :: new ( dummy_user_state) ) ) ;
894+ match timeout ( MESSAGE_HANDLER_LOCK_TIMEOUT , self . user_states . write ( ) ) . await {
895+ Ok ( mut user_states_guard) => {
896+ user_states_guard. insert ( addr, Arc :: new ( Mutex :: new ( dummy_user_state) ) ) ;
897+ }
898+ Err ( _) => {
899+ warn ! ( "User states write lock acquisition timed out" ) ;
900+ self . metrics . inc_message_handler_user_states_lock_timeouts ( ) ;
901+ send_message ( ws_conn_sink, SubmitProofResponseMessage :: ServerBusy ) . await ;
902+ return Ok ( ( ) ) ;
903+ }
904+ } ;
898905 debug ! ( "Dummy user state for address {addr:?} created" ) ;
899906 }
900907
You can’t perform that action at this time.
0 commit comments