WebChat: make tunnel restart handler hop to MainActor
This commit is contained in:
@@ -134,11 +134,10 @@ final class WebChatWindowController: NSWindowController, WKNavigationDelegate {
|
|||||||
|
|
||||||
// Auto-restart on unexpected termination while window lives
|
// Auto-restart on unexpected termination while window lives
|
||||||
tunnel.process.terminationHandler = { [weak self] _ in
|
tunnel.process.terminationHandler = { [weak self] _ in
|
||||||
guard let self else { return }
|
|
||||||
guard self.tunnelRestartEnabled else { return }
|
|
||||||
webChatLogger.error("webchat tunnel terminated; restarting")
|
|
||||||
Task { @MainActor [weak self] in
|
Task { @MainActor [weak self] in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
|
guard self.tunnelRestartEnabled else { return }
|
||||||
|
webChatLogger.error("webchat tunnel terminated; restarting")
|
||||||
do {
|
do {
|
||||||
// Recreate the tunnel silently so the window keeps working without user intervention.
|
// Recreate the tunnel silently so the window keeps working without user intervention.
|
||||||
let base = try await self.startOrRestartTunnel()
|
let base = try await self.startOrRestartTunnel()
|
||||||
|
|||||||
Reference in New Issue
Block a user