@nxtedition/deepstream.io-client-js 23.4.1 → 23.4.2

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": "23.4.1",
3
+ "version": "23.4.2",
4
4
  "description": "the javascript client for deepstream.io",
5
5
  "homepage": "http://deepstream.io",
6
6
  "bugs": {
@@ -48,7 +48,17 @@ class RecordHandler {
48
48
 
49
49
  this._client.on(C.EVENT.CONNECTED, this._onConnectionStateChange.bind(this))
50
50
 
51
+ const _prune = () => {
52
+ if (!this._pruning) {
53
+ this._pruning = true
54
+ this._schedule(prune)
55
+ }
56
+ }
57
+
51
58
  const prune = () => {
59
+ this._now = Date.now()
60
+ this._pruning = false
61
+
52
62
  let counter = 0
53
63
  for (const [rec, timestamp] of this._prune) {
54
64
  if (this._now - timestamp < 1e3) {
@@ -65,22 +75,13 @@ class RecordHandler {
65
75
  this._prune.delete(rec)
66
76
 
67
77
  if (counter++ > 1024) {
68
- this._schedule(prune)
69
- return
78
+ _prune()
70
79
  }
71
80
  }
72
-
73
- this._pruning = false
74
81
  }
75
82
 
76
- const pruneInterval = setInterval(() => {
77
- this._now = Date.now()
78
- if (!this._pruning) {
79
- this._pruning = true
80
- this._schedule(prune)
81
- }
82
- }, 1e3)
83
- pruneInterval.unref?.()
83
+ this._pruneInterval = setInterval(_prune, 1e3)
84
+ this._pruneInterval.unref?.()
84
85
  }
85
86
 
86
87
  _onRef(rec) {