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

Subscribe to PubSub topic before Publishing #30

Merged
merged 2 commits into from
May 3, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ func (p *PubsubValueStore) PutValue(ctx context.Context, key string, value []byt
p.mx.Unlock()
}

Copy link
Member

Choose a reason for hiding this comment

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

We should remove the above bootstrapping lines if we're going to do it this way.

Copy link
Contributor Author

@aschmahmann aschmahmann May 3, 2019

Choose a reason for hiding this comment

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

@Stebalien done. #28 is also now glaringly obvious now, since we see that the context passed in is just ignored.

If you think it makes sense I could wrap the insides of this function (Subscribe + Publish) in a gofunc + channel wait wrapper, but I'm inclined to just leave that until we implement the Discovery in PubSub, per #28 .

Copy link
Member

Choose a reason for hiding this comment

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

I'd leave it as-is. Subscribe shouldn't block anyways.

if err := p.Subscribe(key); err != nil {
return err
}

log.Debugf("PubsubPublish: publish value for key", key)
return p.ps.Publish(topic, value)
}
Expand Down