antietcd 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -576,7 +576,6 @@ type ServerMessage = {
576
576
  - 400 for invalid requests
577
577
  - 404 for unsupported API / URL not found
578
578
  - 405 for non-POST request method
579
- - 408 for lock wait timeouts
580
579
  - 501 for unsupported API feature - non-directory range queries and so on
581
580
  - 502 for server is stopping
582
581
  - 503 for quorum-related errors - quorum not available and so on
package/antietcd.js CHANGED
@@ -20,7 +20,7 @@ const AntiCluster = require('./anticluster.js');
20
20
  const AntiLocker = require('./antilocker.js');
21
21
  const { runCallbacks, de64, b64, RequestError } = require('./common.js');
22
22
 
23
- const VERSION = '1.2.2';
23
+ const VERSION = '1.2.3';
24
24
 
25
25
  class AntiEtcd extends EventEmitter
26
26
  {
package/antilocker.js CHANGED
@@ -128,7 +128,7 @@ class AntiLocker
128
128
  wait_commit(mod_revision, expire_ts)
129
129
  {
130
130
  // Postpone transaction
131
- return new Promise((ok, fail) => this._set_on_unlock(mod_revision, expire_ts, ok, fail));
131
+ return new Promise(ok => this._set_on_unlock(mod_revision, expire_ts, ok));
132
132
  }
133
133
 
134
134
  break_locks()
@@ -139,12 +139,12 @@ class AntiLocker
139
139
  this.on_unlock = [];
140
140
  for (const wait of waits)
141
141
  {
142
- const cb = wait.fail;
143
- cb(new RequestError(408, 'Lock wait aborted, please retry request'));
142
+ const cb = wait.ok;
143
+ cb();
144
144
  }
145
145
  }
146
146
 
147
- _set_on_unlock(lock_rev, expire_ts, ok, fail)
147
+ _set_on_unlock(lock_rev, expire_ts, ok)
148
148
  {
149
149
  let min = 0, max = this.on_unlock.length;
150
150
  while (max-min > 1)
@@ -155,7 +155,7 @@ class AntiLocker
155
155
  else
156
156
  min = mid;
157
157
  }
158
- this.on_unlock.splice(min, 0, { revision: lock_rev, expire_ts, ok, fail });
158
+ this.on_unlock.splice(min, 0, { revision: lock_rev, expire_ts, ok });
159
159
  }
160
160
 
161
161
  _timeout_locks()
@@ -173,8 +173,8 @@ class AntiLocker
173
173
  }
174
174
  for (const wait of cancel)
175
175
  {
176
- const cb = wait.fail;
177
- cb(new RequestError(408, 'Lock wait timeout, please retry request'));
176
+ const cb = wait.ok;
177
+ cb();
178
178
  }
179
179
  }
180
180
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antietcd",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Simplistic etcd replacement based on TinyRaft",
5
5
  "main": "antietcd.js",
6
6
  "scripts": {