Skip to content

Commit fa98493

Browse files
committed
Swallow Publish event exceptions
1 parent 723264b commit fa98493

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/WebJobs.Script/Workers/Rpc/RpcWorkerProcess.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,25 @@ internal override void HandleWorkerProcessExitError(WorkerProcessExitException r
8383

8484
// The subscriber of WorkerErrorEvent is expected to Dispose() the errored channel
8585
_workerProcessLogger.LogError(rpcWorkerProcessExitException, $"Language Worker Process exited. Pid={rpcWorkerProcessExitException.Pid}.", _workerProcessArguments?.ExecutablePath);
86-
_eventManager.Publish(new WorkerErrorEvent(_runtime, _workerId, rpcWorkerProcessExitException));
86+
PublishNoThrow(new WorkerErrorEvent(_runtime, _workerId, rpcWorkerProcessExitException));
8787
}
8888

8989
internal override void HandleWorkerProcessRestart()
9090
{
9191
_workerProcessLogger?.LogInformation("Language Worker Process exited and needs to be restarted.");
92-
_eventManager.Publish(new WorkerRestartEvent(_runtime, _workerId));
92+
PublishNoThrow(new WorkerRestartEvent(_runtime, _workerId));
93+
}
94+
95+
private void PublishNoThrow(RpcChannelEvent @event)
96+
{
97+
try
98+
{
99+
_eventManager.Publish(@event);
100+
}
101+
catch (Exception ex)
102+
{
103+
_workerProcessLogger.LogWarning(ex, "Failed to publish RpcChannelEvent.");
104+
}
93105
}
94106
}
95107
}

0 commit comments

Comments
 (0)