File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
engine/packages/pegboard-gateway/src Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -539,6 +539,16 @@ impl CustomServeTrait for PegboardGateway {
539539 ) -> Result < HibernationResult > {
540540 let request_id = unique_request_id;
541541
542+ // Insert hibernating request entry before checking for pending messages
543+ // This ensures the entry exists even if we immediately rewake the actor
544+ self . ctx
545+ . op ( pegboard:: ops:: actor:: hibernating_request:: upsert:: Input {
546+ actor_id : self . actor_id ,
547+ gateway_id : self . shared_state . gateway_id ( ) ,
548+ request_id,
549+ } )
550+ . await ?;
551+
542552 // Immediately rewake if we have pending messages
543553 if self
544554 . shared_state
@@ -549,6 +559,7 @@ impl CustomServeTrait for PegboardGateway {
549559 ?unique_request_id,
550560 "detected pending requests on websocket hibernation, rewaking actor"
551561 ) ;
562+
552563 return Ok ( HibernationResult :: Continue ) ;
553564 }
554565
@@ -567,6 +578,10 @@ impl CustomServeTrait for PegboardGateway {
567578 ) ) ;
568579 ping_interval. set_missed_tick_behavior ( tokio:: time:: MissedTickBehavior :: Skip ) ;
569580
581+ // Discard the first tick since it fires immediately and we've already called this
582+ // above
583+ ping_interval. tick ( ) . await ;
584+
570585 loop {
571586 ping_interval. tick ( ) . await ;
572587
You can’t perform that action at this time.
0 commit comments