@@ -22,7 +22,7 @@ mod setup;
22
22
/// How often to check for a PID when one is not present and a stop command was received.
23
23
const STOP_PID_INTERVAL : Duration = std:: time:: Duration :: from_millis ( 250 ) ;
24
24
/// How many times to check for a PID when a stop command was received.
25
- const STOP_PID_RETRIES : usize = 32 ;
25
+ const STOP_PID_RETRIES : usize = 1024 ;
26
26
27
27
pub struct Actor {
28
28
actor_id : Uuid ,
@@ -377,16 +377,31 @@ impl Actor {
377
377
378
378
// Signal command might be sent before the actor has a runner. This loop waits for the runner to start
379
379
let runner_guard = loop {
380
- let runner_guard = self . runner . lock ( ) . await ;
381
- if runner_guard. is_some ( ) {
382
- break Some ( runner_guard) ;
380
+ {
381
+ let runner_guard = self . runner . lock ( ) . await ;
382
+ if runner_guard. is_some ( ) {
383
+ break Some ( runner_guard) ;
384
+ }
383
385
}
384
386
385
- tracing:: warn!(
386
- actor_id=?self . actor_id,
387
- generation=?self . generation,
388
- "waiting for pid to signal actor" ,
389
- ) ;
387
+ if * self . exited . lock ( ) . await {
388
+ tracing:: warn!(
389
+ actor_id=?self . actor_id,
390
+ generation=?self . generation,
391
+ "actor exited before PID was set, ignoring signal" ,
392
+ ) ;
393
+
394
+ break None ;
395
+ }
396
+
397
+ // Progress log
398
+ if i % 10 == 0 {
399
+ tracing:: warn!(
400
+ actor_id=?self . actor_id,
401
+ generation=?self . generation,
402
+ "waiting for PID to signal actor" ,
403
+ ) ;
404
+ }
390
405
391
406
if i > STOP_PID_RETRIES {
392
407
tracing:: error!(
@@ -396,6 +411,7 @@ impl Actor {
396
411
397
412
break None ;
398
413
}
414
+
399
415
i += 1 ;
400
416
401
417
tokio:: time:: sleep ( STOP_PID_INTERVAL ) . await ;
0 commit comments