@nxtedition/deepstream.io-client-js 23.4.29 → 23.4.30
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 +1 -1
- package/src/record/record-handler.js +15 -2
package/package.json
CHANGED
|
@@ -30,6 +30,8 @@ class RecordHandler {
|
|
|
30
30
|
this._connected = 0
|
|
31
31
|
this._stats = {
|
|
32
32
|
updating: 0,
|
|
33
|
+
created: 0,
|
|
34
|
+
destroyed: 0,
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
this._syncEmitter = new EventEmitter()
|
|
@@ -46,6 +48,8 @@ class RecordHandler {
|
|
|
46
48
|
|
|
47
49
|
this._client.on(C.EVENT.CONNECTED, this._onConnectionStateChange.bind(this))
|
|
48
50
|
|
|
51
|
+
this._pruneTimeout = null
|
|
52
|
+
|
|
49
53
|
// TODO (perf): schedule & yield to avoid blocking event loop?
|
|
50
54
|
const _pruneSome = () => {
|
|
51
55
|
const prune = this._prune
|
|
@@ -55,10 +59,17 @@ class RecordHandler {
|
|
|
55
59
|
invariant(rec.pending === false && rec.refs === 0)
|
|
56
60
|
rec._unsubscribe()
|
|
57
61
|
this._records.delete(rec.name)
|
|
62
|
+
this._stats.destroyed++
|
|
58
63
|
}
|
|
59
64
|
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
if (this._pruneTimeout && this._pruneTimeout.refresh) {
|
|
66
|
+
this._pruneTimeout.refresh()
|
|
67
|
+
} else {
|
|
68
|
+
this._prunetimeout = setTimeout(_pruneSome, 1e3)
|
|
69
|
+
if (this._pruneTimeout.unref) {
|
|
70
|
+
this._pruneTimeout.unref()
|
|
71
|
+
}
|
|
72
|
+
}
|
|
62
73
|
}
|
|
63
74
|
|
|
64
75
|
_pruneSome()
|
|
@@ -98,6 +109,7 @@ class RecordHandler {
|
|
|
98
109
|
listeners: this._listeners.size,
|
|
99
110
|
records: this._records.size,
|
|
100
111
|
pruning: this._prune.size,
|
|
112
|
+
pending: this._patch.size,
|
|
101
113
|
}
|
|
102
114
|
}
|
|
103
115
|
|
|
@@ -112,6 +124,7 @@ class RecordHandler {
|
|
|
112
124
|
if (!record) {
|
|
113
125
|
record = new Record(name, this)
|
|
114
126
|
this._records.set(name, record)
|
|
127
|
+
this._stats.destroyed--
|
|
115
128
|
} else {
|
|
116
129
|
record.ref()
|
|
117
130
|
}
|