From 80dfe596b90dd7303103caab89f3fb73433a73b9 Mon Sep 17 00:00:00 2001 From: Patrick Stein Date: Tue, 15 Aug 2023 11:43:19 +0200 Subject: [PATCH] improved debug output for SMADeviceCacheEntry. --- Sources/sma2mqttLibrary/SMALighthouse.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/sma2mqttLibrary/SMALighthouse.swift b/Sources/sma2mqttLibrary/SMALighthouse.swift index eb90906..1af8539 100644 --- a/Sources/sma2mqttLibrary/SMALighthouse.swift +++ b/Sources/sma2mqttLibrary/SMALighthouse.swift @@ -28,7 +28,7 @@ public actor SMALighthouse { case inProgress(Task) case ready(SMADevice) - case failed(Date) + case failed(String, Date) var asyncDescription: String { get async @@ -38,7 +38,7 @@ public actor SMALighthouse case .inProgress: return "inProgress()\n" case let .ready(smaDevice): let deviceDescription = await smaDevice.asyncDescription return "ready(\(smaDevice.address)): \(deviceDescription)\n" - case let .failed(date): return "failed(\(date))\n" + case let .failed(address, date): return "failed(\(address),\(date))\n" } } } @@ -113,10 +113,10 @@ public extension SMALighthouse case let .inProgress(task): return try? await task.value - case let .failed(date): + case let .failed(address, date): if date.isWithin(timeInterval: 30.0) { - JLog.info("still ignoring:\(remoteAddress)") + JLog.info("still ignoring:\(address) == \(remoteAddress)") return nil } JLog.info("renabling:\(remoteAddress)") @@ -139,7 +139,7 @@ public extension SMALighthouse { JLog.error("\(remoteAddress): was not able to initialize:\(error) - ignoring address") - smaDeviceCache[remoteAddress] = .failed(Date()) + smaDeviceCache[remoteAddress] = .failed(remoteAddress, Date()) return nil } }