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

chore: modifying relay subscribe return value #3214

Closed
wants to merge 1 commit into from

Conversation

gabrielmer
Copy link
Contributor

Description

Currently, WakuRelay.subscribe() has a return value that is discarded everywhere except in one place. It returns the wrapped handler that is passed to gossipsub, which is useless to most cases when we subscribe to a topic.

Therefore, defined a wrapHandler() procedure to return the wrapped handler in the specific cases that is needed, and changed the return type of subscribe to void so we don't have to discard that value everywhere

Changes

  • changed return value of WakuRelay.subscribe() to void
  • defined a wrapHandler() procedure in the waku_relay module

Copy link

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:3214

Built from 6da1bd1

@gabrielmer
Copy link
Contributor Author

Well, looking at the failed test I noticed that we do need to pass the wrapped handler when calling unsubscribe (as unsubscribing is from a specific handler). So maybe it does sense to return it and this PR is irrelevant? LMK what you think

@gabrielmer gabrielmer marked this pull request as draft December 17, 2024 20:36
@Ivansete-status
Copy link
Collaborator

Well, looking at the failed test I noticed that we do need to pass the wrapped handler when calling unsubscribe (as unsubscribing is from a specific handler). So maybe it does sense to return it and this PR is irrelevant? LMK what you think

Thanks for this!
IMO, we need to allow subscription and unsubscription but it shouldn't be needed to deal with any handler at all to unsubscribe. The only parameters needed to subscribe/unsubscribe should be the pubsubTopic , a.k.a. cluster-id+shard

@gabrielmer
Copy link
Contributor Author

Thanks for this! IMO, we need to allow subscription and unsubscription but it shouldn't be needed to deal with any handler at all to unsubscribe. The only parameters needed to subscribe/unsubscribe should be the pubsubTopic , a.k.a. cluster-id+shard

I understand not dealing with handlers when unsubscribing, but I think we do need to have a handler as a parameter when subscribing right? the idea of subscribing is running a custom procedure when a message is received, it seems as it is really important to be able to define and pass that procedure through. But I might be missing something :))

@Ivansete-status
Copy link
Collaborator

I understand not dealing with handlers when unsubscribing, but I think we do need to have a handler as a parameter when subscribing right? the idea of subscribing is running a custom procedure when a message is received, it seems as it is really important to be able to define and pass that procedure through. But I might be missing something :))

Yes you are right ! Nevertheless, I think we only need one handler for all subscriptions. f.e., in libwaku we are passing the same handler to all subscriptions :)

@gabrielmer
Copy link
Contributor Author

After further discussions, opened issue #3222 and closing this PR :)

@gabrielmer gabrielmer closed this Dec 18, 2024
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.

2 participants