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

Timeouts of a second lock waiting for a first lock to yield #1

Open
naddison36 opened this issue Jul 11, 2018 · 1 comment
Open

Timeouts of a second lock waiting for a first lock to yield #1

naddison36 opened this issue Jul 11, 2018 · 1 comment

Comments

@naddison36
Copy link
Contributor

Thanks for open sourcing this library. It's very close to what I've been looking for.

In the below test I have the first lock holding for 6 seconds while the second lock only has a 3 second timeout. After six seconds of waiting, the second lock yields and continues on with no error but does not have the lock. This doesn't seem right to me. I would have expected either:

  1. The second lock is held for three seconds after it yields
  2. The second lock throws an error as it was unable to get the lock in the 3 second timeout period
it('timeout waiting for a lock', function * () {
      yield client.lock('node_lock_test_8', 6000)
      yield client.lock('node_lock_test_8', 3000)

      let isLocked = yield client.isLocked('node_lock_test_8')
      assert(isLocked === true)
    })
  })

Note the following test passes but the second lock is only held for 1 second and not 7 from when it yields.

it('timeout waiting for a lock', function * () {
      yield client.lock('node_lock_test_8', 6000)
      yield client.lock('node_lock_test_8', 7000)

      let isLocked = yield client.isLocked('node_lock_test_8')
      assert(isLocked === true)
    })
  })
@naddison36
Copy link
Contributor Author

I think this is more an issue with etcd's locking solution than this library. I've raise etcd-io/etcd#9921

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

No branches or pull requests

1 participant