Skip to content
This repository was archived by the owner on Jun 13, 2023. It is now read-only.

Commit 8715b15

Browse files
JoeSzymanskiflovilmart
authored andcommitted
Update unsubscribe to remove subscriptions from the tracked subscriptions list (#139)
1 parent b039624 commit 8715b15

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Sources/ParseLiveQuery/Client.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,15 @@ extension Client {
207207
}
208208

209209
func unsubscribe(matching matcher: @escaping (SubscriptionRecord) -> Bool) {
210-
subscriptions.filter {
211-
matcher($0)
212-
}.forEach {
213-
_ = sendOperationAsync(.unsubscribe(requestId: $0.requestId))
210+
var temp = [SubscriptionRecord]()
211+
subscriptions.forEach {
212+
if matcher($0) {
213+
_ = sendOperationAsync(.unsubscribe(requestId: $0.requestId))
214+
} else {
215+
temp.append($0)
216+
}
214217
}
218+
subscriptions = temp
215219
}
216220
}
217221

0 commit comments

Comments
 (0)