Skip to content

Commit 4e71ffb

Browse files
Update implementation comments in EmbeddedEventLoop and AsyncTestingEventLoop
1 parent b16a575 commit 4e71ffb

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

Sources/NIOEmbedded/AsyncTestingEventLoop.swift

+3-4
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,9 @@ public final class NIOAsyncTestingEventLoop: EventLoop, @unchecked Sendable {
173173

174174
@discardableResult
175175
public func scheduleCallback(in amount: TimeAmount, handler: some NIOScheduledCallbackHandler) -> NIOScheduledCallback {
176-
// TODO: docs
177-
/// Even though this type does not conform to `CustomTimerImplemenation`, it has a manual clock so we cannot
178-
/// rely on the default implemntation of `setTimer(for duration:_:)`, which computes the deadline for
179-
/// `setTimer(for deadline:_:)` naively using `NIODeadline.now`, but we must use `self.now`.
176+
/// Even though this type does not implement a custom `scheduleCallback(at:handler)`, it has a manual clock so
177+
/// we cannot rely on the default implemntation of `setTimer(for:handler:)`, which computes the deadline as an
178+
/// offset from `NIODeadline.now`. This event loop needs the deadline to be offset from `self.now`.
180179
self.scheduleCallback(at: self.now + amount, handler: handler)
181180
}
182181

Sources/NIOEmbedded/Embedded.swift

+3-4
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,9 @@ public final class EmbeddedEventLoop: EventLoop {
129129

130130
@discardableResult
131131
public func scheduleCallback(in amount: TimeAmount, handler: some NIOScheduledCallbackHandler) -> NIOScheduledCallback {
132-
// TODO: docs
133-
/// Even though this type does not conform to `CustomTimerImplemenation`, it has a manual clock so we cannot
134-
/// rely on the default implemntation of `setTimer(for duration:_:)`, which computes the deadline for
135-
/// `setTimer(for deadline:_:)` naively using `NIODeadline.now`, but we must use `self._now`.
132+
/// Even though this type does not implement a custom `scheduleCallback(at:handler)`, it has a manual clock so
133+
/// we cannot rely on the default implemntation of `setTimer(for:handler:)`, which computes the deadline as an
134+
/// offset from `NIODeadline.now`. This event loop needs the deadline to be offset from `self._now`.
136135
self.scheduleCallback(at: self._now + amount, handler: handler)
137136
}
138137

0 commit comments

Comments
 (0)