Skip to content

Commit

Permalink
Update NotifySubsctiptionsUpdater.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
flypaper0 committed Jan 29, 2024
1 parent feaa314 commit abaa83d
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,13 @@ final class NotifySubsctiptionsUpdater {
try kms.setSymmetricKey(symKey, for: subscription.topic)
}

let topics = newSubscriptions.map { $0.topic }
let topicsToSubscribe = newSubscriptions.map { $0.topic }

try await networkingInteractor.batchSubscribe(topics: topics)
let oldTopics = Set(oldSubscriptions.map { $0.topic })
let topicsToUnsubscribe = Array(oldTopics.subtracting(topicsToSubscribe))

try await networkingInteractor.batchUnsubscribe(topics: topicsToUnsubscribe)
try await networkingInteractor.batchSubscribe(topics: topicsToSubscribe)

try Task.checkCancellation()

Expand Down

0 comments on commit abaa83d

Please sign in to comment.