From 638dde24c81235837330f5ef195eb89fb31c9406 Mon Sep 17 00:00:00 2001 From: Jaleel Akbashev Date: Thu, 21 May 2026 08:51:45 +0200 Subject: [PATCH 1/3] changed timesource to use clock revert var Unnecessary comment --- .../Cluster/SWIM/SWIMActorClusteredTests.swift | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Tests/DistributedClusterTests/Cluster/SWIM/SWIMActorClusteredTests.swift b/Tests/DistributedClusterTests/Cluster/SWIM/SWIMActorClusteredTests.swift index 68769c9a8..d119d7377 100644 --- a/Tests/DistributedClusterTests/Cluster/SWIM/SWIMActorClusteredTests.swift +++ b/Tests/DistributedClusterTests/Cluster/SWIM/SWIMActorClusteredTests.swift @@ -484,18 +484,19 @@ final class SWIMActorClusteredTests: ClusteredActorSystemsXCTestCase { } class TestTimeSource { - let currentTime: UnsafeAtomic + private var instant: ContinuousClock.Instant /// starting from 1 to ensure .distantPast is already expired - init(currentTime: UInt64 = 1) { - self.currentTime = .create(currentTime) + init(currentTime: ContinuousClock.Instant = (.now - .nanoseconds(1))) { + self.instant = currentTime } - func now() -> DispatchTime { - DispatchTime(uptimeNanoseconds: self.currentTime.load(ordering: .relaxed)) + @Sendable + func now() -> ContinuousClock.Instant { + self.instant } - func tick() { - _ = self.currentTime.loadThenWrappingIncrement(by: 100, ordering: .relaxed) + func tick(by duration: Duration = .nanoseconds(100)) { + self.instant += duration } } From 03074bbe6c8c06686486b34115f23f18f30f7848 Mon Sep 17 00:00:00 2001 From: Jaleel Akbashev Date: Thu, 21 May 2026 10:28:25 +0200 Subject: [PATCH 2/3] better rename back to currentTime --- .../Cluster/SWIM/SWIMActorClusteredTests.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Tests/DistributedClusterTests/Cluster/SWIM/SWIMActorClusteredTests.swift b/Tests/DistributedClusterTests/Cluster/SWIM/SWIMActorClusteredTests.swift index d119d7377..6731d0a4a 100644 --- a/Tests/DistributedClusterTests/Cluster/SWIM/SWIMActorClusteredTests.swift +++ b/Tests/DistributedClusterTests/Cluster/SWIM/SWIMActorClusteredTests.swift @@ -484,19 +484,19 @@ final class SWIMActorClusteredTests: ClusteredActorSystemsXCTestCase { } class TestTimeSource { - private var instant: ContinuousClock.Instant + private var currentTime: ContinuousClock.Instant /// starting from 1 to ensure .distantPast is already expired init(currentTime: ContinuousClock.Instant = (.now - .nanoseconds(1))) { - self.instant = currentTime + self.currentTime = currentTime } @Sendable func now() -> ContinuousClock.Instant { - self.instant + self.currentTime } func tick(by duration: Duration = .nanoseconds(100)) { - self.instant += duration + self.currentTime += duration } } From a8333fa0035f8fb71a4529f1f31c4df27b081be0 Mon Sep 17 00:00:00 2001 From: Jaleel Akbashev Date: Thu, 28 May 2026 10:35:20 +0200 Subject: [PATCH 3/3] format fix --- Sources/DistributedCluster/String+Extensions.swift | 2 -- 1 file changed, 2 deletions(-) diff --git a/Sources/DistributedCluster/String+Extensions.swift b/Sources/DistributedCluster/String+Extensions.swift index e0e89c1a2..36c2fe94a 100644 --- a/Sources/DistributedCluster/String+Extensions.swift +++ b/Sources/DistributedCluster/String+Extensions.swift @@ -210,5 +210,3 @@ extension String.StringInterpolation { self.appendLiteral("[\(ref.id.path)]") } } - -