@nxtedition/deepstream.io-client-js 24.1.11 → 24.1.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/deepstream.io-client-js",
3
- "version": "24.1.11",
3
+ "version": "24.1.13",
4
4
  "description": "the javascript client for deepstream.io",
5
5
  "homepage": "http://deepstream.io",
6
6
  "bugs": {
@@ -52,18 +52,21 @@ function onTimeout(subscription) {
52
52
  }
53
53
 
54
54
  function onUpdateFast(rec, opaque) {
55
+ const { timeout, resolve } = opaque
56
+
55
57
  if (rec.state >= opaque.state) {
56
- timers.clearTimeout(opaque.timeout)
58
+ timers.clearTimeout(timeout)
57
59
  rec.unsubscribe(onUpdateFast, opaque)
58
60
  rec.unref()
59
- opaque.resolve(rec.data)
61
+ resolve(rec.data)
60
62
  }
61
63
  }
62
64
 
63
65
  function onTimeoutFast(opaque) {
64
- opaque.unsubscribe(onUpdateFast, opaque)
65
- opaque.unref()
66
- opaque.resolve(
66
+ const { rec, resolve } = opaque
67
+ rec.unsubscribe(onUpdateFast, opaque)
68
+ rec.unref()
69
+ resolve(
67
70
  Promise.reject(
68
71
  Object.assign(new Error(`timeout ${opaque.rec.name} [${opaque.rec.state}<${opaque.state}]`), {
69
72
  code: 'ETIMEDOUT',
@@ -393,7 +396,7 @@ class RecordHandler {
393
396
  const rec = this.getRecord(args[0])
394
397
  const state = args.length === 2 ? args[1] : C.RECORD_STATE.SERVER
395
398
 
396
- if (rec.state < state) {
399
+ if (rec.state >= state) {
397
400
  rec.unref()
398
401
  resolve(rec.data)
399
402
  } else {