File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -575,6 +575,7 @@ private void StartDaemonProcess()
575
575
/// </summary>
576
576
private async Task StopDaemon ( CancellationToken ct )
577
577
{
578
+ _logger . LogDebug ( "stopping mutagen daemon" ) ;
578
579
var process = _daemonProcess ;
579
580
var client = _mutagenClient ;
580
581
var writer = _logWriter ;
@@ -587,28 +588,34 @@ private async Task StopDaemon(CancellationToken ct)
587
588
if ( client == null )
588
589
{
589
590
if ( process == null ) return ;
591
+ _logger . LogDebug ( "no client; killing daemon process" ) ;
590
592
process . Kill ( true ) ;
591
593
}
592
594
else
593
595
{
594
596
try
595
597
{
598
+ _logger . LogDebug ( "sending DaemonTerminateRequest" ) ;
596
599
await client . Daemon . TerminateAsync ( new DaemonTerminateRequest ( ) , cancellationToken : ct ) ;
597
600
}
598
- catch
601
+ catch ( Exception e )
599
602
{
603
+ _logger . LogError ( e , "failed to gracefully terminate agent" ) ;
600
604
if ( process == null ) return ;
605
+ _logger . LogDebug ( "killing daemon process after failed graceful termination" ) ;
601
606
process . Kill ( true ) ;
602
607
}
603
608
}
604
609
605
610
if ( process == null ) return ;
606
611
var cts = CancellationTokenSource . CreateLinkedTokenSource ( ct ) ;
607
612
cts . CancelAfter ( TimeSpan . FromSeconds ( 5 ) ) ;
613
+ _logger . LogDebug ( "waiting for process to exit" ) ;
608
614
await process . WaitForExitAsync ( cts . Token ) ;
609
615
}
610
616
finally
611
617
{
618
+ _logger . LogDebug ( "cleaning up daemon process objects" ) ;
612
619
client ? . Dispose ( ) ;
613
620
process ? . Dispose ( ) ;
614
621
writer ? . Dispose ( ) ;
You can’t perform that action at this time.
0 commit comments