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

Topic handler bug fixes #225

Merged
merged 3 commits into from
Nov 4, 2019
Merged

Topic handler bug fixes #225

merged 3 commits into from
Nov 4, 2019

Conversation

aschmahmann
Copy link
Contributor

Fixes the issues named in #224 namely:

Calling Topic.Close() throws an NRE 😨
Calling Topic.Close() still allows some calls to be utilized (e.g. can still Publish after Close)

@aschmahmann aschmahmann changed the title Fix/224 Topic handler bug fixes Nov 1, 2019
topic.go Outdated Show resolved Hide resolved
topic.go Outdated Show resolved Hide resolved
topic.go Outdated
if t.closed {
return nil
}

req := &rmTopicReq{t, make(chan error, 1)}
t.p.rmTopic <- req
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was true for all previous PubSub functions and the new Topic ones. I've pushed an update, lmk if that's what you had in mind.

Three questions about fixing this:

  1. Do I want custom ErrPubSubClosed messages or is the context error enough (both for the PubSub functions and for the Topic functions)?
  2. Should I set Topic.closed=true on any/all of the pubsub context errors?
  3. It seems more reasonable to return an empty array then nil for GetTopics and ListPeers right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vyzo any thoughts on the first 2 questions here? Would like to get this pushed out ASAP since the Close bug is particularly bad.

Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. either works, it's a very small thing.
  2. probably not, I don't see what we would gain from this.

Copy link
Collaborator

@vyzo vyzo left a comment

Choose a reason for hiding this comment

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

LGTM modulo the nit about returning nil for empty lists.
But that's not normative, feel free to fix or leave it as is.

pubsub.go Outdated Show resolved Hide resolved
pubsub.go Outdated Show resolved Hide resolved
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