Skip to content
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

feat: seaprate blocking methods #72

Merged
merged 2 commits into from
Mar 11, 2024
Merged

Conversation

heilhead
Copy link
Collaborator

@heilhead heilhead commented Mar 8, 2024

Description

This creates a separate irn_subscribeBlocking and irn_batchSubscribeBlocking methods which were previously behind the block flag in the main method payloads.

Also removes the requirement to pass subscription IDs to unsubscribe.

How Has This Been Tested?

Relay integration.

Due Diligence

  • Breaking change
  • Requires a documentation update
  • Requires a e2e/integration test update

@@ -142,21 +142,13 @@ impl Client {
/// when fully processed by the relay.
/// Note: This function is experimental and will likely be removed in the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it still experimental?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We haven't thought about it, but we've changed the API a couple of times already. So yeah, I'd consider it experimental still.

) -> ResponseFuture<BatchSubscribe> {
let (request, response) = create_request(BatchSubscribe {
) -> impl Future<
Output = Result<
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit ugly, I would use a type alias for this. clippy should have noticed this 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't the function just async?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making the function async would capture self reference for the lifetime of that future, which I wanted to avoid initially. Now why would I want to avoid capturing self is another question. Maybe in the initial implementation there were some methods that required &mut self, so I didn't want to mix immutable and mutable borrowing, not sure. But yeah, now that the client API is stable-ish, we could just convert these methods to be async and return anonymous futures.

})
.await
) -> Result<
Vec<Result<SubscriptionId, Error<rpc::SubscriptionError>>>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why return SubscriptionId still? Maybe change to ()?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess doesn't hurt to have in the future if needed

@heilhead heilhead merged commit 7664418 into main Mar 11, 2024
8 checks passed
@heilhead heilhead deleted the feat/separate-blocking-methods branch March 11, 2024 07:14
@heilhead heilhead mentioned this pull request Mar 11, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants