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

read() read(wait=True) racecondition #200

Open
mb-dbc-dk opened this issue Sep 20, 2016 · 1 comment
Open

read() read(wait=True) racecondition #200

mb-dbc-dk opened this issue Sep 20, 2016 · 1 comment
Labels

Comments

@mb-dbc-dk
Copy link

As I see it, there's no way of "get or wait for" key, in the read call.

you can do:

try:
  return client.read(key)
except EtcdKeyNotFound as e:
  return client.read(key, wait=True, timeout=...)

However I just got hit by, key created between the 2 calls.
I did this for a number of keys, that were created in the same order, the 2 scripts got synchronized, and race condition appeared (not very often, only got hit by it once).

@lavagetto
Copy link
Collaborator

I'm not sure if we make available the etcd index of the response in the case of a 404 response; we should probably do that so that you can wait on the key from the index you got on your first request.

@lavagetto lavagetto added the bug label Jun 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants