Skip to content

Commit 836e499

Browse files
Handle MPF early shutdown because of BCP
1 parent 7808784 commit 836e499

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Runtime/MpfWrangler.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,20 @@ public async Task StopMpf()
287287
var client = new MpfHardwareService.MpfHardwareServiceClient(_grpcChannel);
288288
try
289289
{
290-
await client.QuitAsync(
290+
await Task.Delay(100);
291+
_ = await client.QuitAsync(
291292
new QuitRequest(),
292293
deadline: DateTime.UtcNow.AddSeconds(1)
293294
);
294295
}
296+
catch (RpcException ex) when (_mediaController == MpfMediaController.Other)
297+
{
298+
Logger.Info(
299+
"MPF did not respond to the quit RPC. This is probably because MPF "
300+
+ "has already shut down because the BCP connection was closed."
301+
+ $"Exception: {ex}"
302+
);
303+
}
295304
finally
296305
{
297306
try

0 commit comments

Comments
 (0)