Skip to content

use consul-go - #2

Merged
thehydroimpulse merged 2 commits into
masterfrom
consul
May 23, 2017
Merged

use consul-go#2
thehydroimpulse merged 2 commits into
masterfrom
consul

Conversation

@thehydroimpulse

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread consul.go Outdated
res, _, err := reader.client.KV().Acquire(pair, &api.WriteOptions{})
if err != nil {
return 0, err
lock, _ := consul.Lock(ctx, baseKey+reader.name+"/"+strconv.Itoa(partition))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

how do we specify the client or does it automatically grab the session's client from the context? @achille-roussel

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe this is documented already:
=> https://github.com/segmentio/consul-go/blob/master/README.md#sessions-and-locks
=> https://godoc.org/github.com/segmentio/consul-go#Locker
=> https://godoc.org/github.com/segmentio/consul-go#WithSession
You can check the centrifuge code as well for reference, let me know if anything is still not clear.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks! the api was just a bit different than what I was expecting.

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