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