@nxtedition/deepstream.io-client-js 23.4.26 → 23.4.27

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