Skip to content

Commit af2a121

Browse files
committed
use [weak self] in controller-side message batcher
1 parent a041573 commit af2a121

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Sources/SwiftOCA/OCP.1/Ocp1MessageBatcher.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,11 @@ final class Ocp1MessageBatcher: Sendable {
9494
private func startPeriodicDequeue() {
9595
guard periodicTask == nil else { return }
9696

97-
periodicTask = Task {
97+
let dequeueInterval = dequeueInterval
98+
99+
periodicTask = Task { [weak self, dequeueInterval] in
98100
try await Task.sleep(for: dequeueInterval) // will check for cancellation
99-
try await dequeue()
101+
try await self?.dequeue()
100102
}
101103
}
102104

0 commit comments

Comments
 (0)