libp2p / libp2p/go-libp2p-pubsub

Allow Topics to close any handles they have

Open
#237 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
364
Forks
221
PR merge metrics
No merged PRs in 30d

Description

@Stebalien mentioned in https://github.com/libp2p/go-libp2p-pubsub-router/pull/37#discussion_r345971256 that the restrictions posed on closing a Topic handle shouldn't need to exist https://github.com/libp2p/go-libp2p-pubsub/blob/01b9825fbee1848751d90a8469e3f5f43bac8466/topic.go#L187

IIUC the reasoning is that since only one valid `Topic` handle can exist for a given topic that when that handler calls `Close()` it is willing to kill any existing `Subscription` or `TopicEventHandler` objects that are outstanding.

This may clean up some code, by removing a bunch of error checking/handling, but comes at the cost of adding complexity for a `Topic` with N `Subscription`s that only wants to close when all N `Subscription`s are closed.

Both options are by me. WDYT @vyzo?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with topic.go around line 187 and read the linked discussion in pull request 37 to understand the current restrictions on closing Topic handles. Compare the proposed behavior with the existing Subscription and TopicEventHandler lifecycle, then confirm the desired API semantics with maintainers before identifying tests or implementation changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
distributed-systems, networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.