-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Batch subscribe #716
Batch subscribe #716
Conversation
@@ -32,6 +32,7 @@ class ResubscriptionService { | |||
|
|||
func resubscribe(account: Account) async throws { | |||
let topics = chatStorage.getThreads(account: account).map { $0.topic } | |||
guard !topics.isEmpty else { return } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may be do this check inside butchSubscribe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we do but it throws an error batchContainsNoItems
.asRPCRequest() | ||
let message = try! request.asJSONEncodedString() | ||
var cancellable: AnyCancellable? | ||
cancellable = batchSubscriptionResponsePublisher |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are doing the same logic in different places. Could we refactor it somehow?
@@ -292,6 +317,8 @@ public final class RelayClient { | |||
requestAcknowledgePublisherSubject.send(response.id) | |||
} else if let subscriptionId = try? anyCodable.get(String.self) { | |||
subscriptionResponsePublisherSubject.send((response.id, subscriptionId)) | |||
} else if let subscriptionIds = try? anyCodable.get([String].self) { | |||
batchSubscriptionResponsePublisherSubject.send((response.id, subscriptionIds)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to use different ack publishers? Can we use one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 we can
Description
Resolves #708
How Has This Been Tested?
Due Dilligence