Skip to content

Commit

Permalink
refactor: optimize isLocked()
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidCai1111 committed Sep 28, 2017
1 parent f24c9a6 commit 73e2003
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ class Locker {

const { count } = yield this._promisify('kv', 'range', {
key,
range_end: this._getPrefixEndRange(key)
range_end: this._getPrefixEndRange(key),
count_only: true
})

return Number(count) !== 0
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-etcd-lock",
"version": "0.2.3",
"version": "0.2.4",
"description": "Distributed locks powered by etcd v3 for Node.js",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 73e2003

Please sign in to comment.