Skip to content

Commit 0f30a70

Browse files
fix susbcriber
1 parent b73ad6b commit 0f30a70

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

Tests/AblyLiveObjectsTests/Helpers/Subscriber.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ final class Subscriber<each CallbackArg: Sendable>: Sendable {
4444
let invocation = (repeat each arg)
4545
invocations.append(invocation)
4646

47-
let listeners = self.listeners
48-
return {
47+
return { [listeners] in
4948
for listener in listeners {
5049
listener.callAsFunction(repeat each invocation)
5150
}
@@ -76,10 +75,11 @@ final class Subscriber<each CallbackArg: Sendable>: Sendable {
7675
let performInvocations = mutex.withLock {
7776
listeners.append(.init(callback: listener))
7877

79-
let invocations = self.invocations
80-
return {
78+
return { [invocations, callbackQueue] in
8179
for invocation in invocations {
82-
listener(repeat each invocation)
80+
callbackQueue.async {
81+
listener(repeat each invocation)
82+
}
8383
}
8484
}
8585
}

0 commit comments

Comments
 (0)