fix holeControlPlane
This commit is contained in:
parent
1907c4347b
commit
bba1180b11
@ -297,48 +297,6 @@ actor SDLContextActor {
|
||||
}
|
||||
}
|
||||
|
||||
private static func runRestarting(
|
||||
name: String,
|
||||
retryDelay: Duration = .seconds(5),
|
||||
operation: @escaping @Sendable () async throws -> Void
|
||||
) async throws {
|
||||
while !Task.isCancelled {
|
||||
do {
|
||||
try Task.checkCancellation()
|
||||
try await operation()
|
||||
SDLLogger.log("[SDLContext] worker \(name) ended, will restart", for: .debug)
|
||||
} catch is CancellationError {
|
||||
SDLLogger.log("[SDLContext] worker \(name) cancelled", for: .debug)
|
||||
throw CancellationError()
|
||||
} catch {
|
||||
SDLLogger.log("[SDLContext] worker \(name) crashed: \(error.localizedDescription), will restart", for: .debug)
|
||||
}
|
||||
|
||||
try await Task.sleep(for: retryDelay)
|
||||
}
|
||||
}
|
||||
|
||||
private static func runPeriodic(
|
||||
name: String,
|
||||
interval: Duration,
|
||||
retryDelay: Duration = .seconds(5),
|
||||
operation: @escaping @Sendable () async throws -> Void
|
||||
) async throws {
|
||||
while !Task.isCancelled {
|
||||
do {
|
||||
try Task.checkCancellation()
|
||||
try await operation()
|
||||
try await Task.sleep(for: interval)
|
||||
} catch is CancellationError {
|
||||
SDLLogger.log("[SDLContext] worker \(name) cancelled", for: .debug)
|
||||
throw CancellationError()
|
||||
} catch {
|
||||
SDLLogger.log("[SDLContext] worker \(name) crashed: \(error.localizedDescription), will retry", for: .debug)
|
||||
try await Task.sleep(for: retryDelay)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func runIPv6AssistSupervisor() async throws {
|
||||
do {
|
||||
for await assistInfo in self.ipv6AssistEvents {
|
||||
@ -583,3 +541,49 @@ extension SDLContextActor {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension SDLContextActor {
|
||||
|
||||
private static func runRestarting(
|
||||
name: String,
|
||||
retryDelay: Duration = .seconds(5),
|
||||
operation: @escaping @Sendable () async throws -> Void
|
||||
) async throws {
|
||||
while !Task.isCancelled {
|
||||
do {
|
||||
try Task.checkCancellation()
|
||||
try await operation()
|
||||
SDLLogger.log("[SDLContext] worker \(name) ended, will restart", for: .debug)
|
||||
} catch is CancellationError {
|
||||
SDLLogger.log("[SDLContext] worker \(name) cancelled", for: .debug)
|
||||
throw CancellationError()
|
||||
} catch {
|
||||
SDLLogger.log("[SDLContext] worker \(name) crashed: \(error.localizedDescription), will restart", for: .debug)
|
||||
}
|
||||
|
||||
try await Task.sleep(for: retryDelay)
|
||||
}
|
||||
}
|
||||
|
||||
private static func runPeriodic(
|
||||
name: String,
|
||||
interval: Duration,
|
||||
retryDelay: Duration = .seconds(5),
|
||||
operation: @escaping @Sendable () async throws -> Void
|
||||
) async throws {
|
||||
while !Task.isCancelled {
|
||||
do {
|
||||
try Task.checkCancellation()
|
||||
try await operation()
|
||||
try await Task.sleep(for: interval)
|
||||
} catch is CancellationError {
|
||||
SDLLogger.log("[SDLContext] worker \(name) cancelled", for: .debug)
|
||||
throw CancellationError()
|
||||
} catch {
|
||||
SDLLogger.log("[SDLContext] worker \(name) crashed: \(error.localizedDescription), will retry", for: .debug)
|
||||
try await Task.sleep(for: retryDelay)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user