@nxtedition/deepstream.io-client-js 32.0.2 → 32.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/deepstream.io-client-js",
3
- "version": "32.0.2",
3
+ "version": "32.0.3",
4
4
  "description": "the javascript client for deepstream.io",
5
5
  "homepage": "http://deepstream.io",
6
6
  "type": "module",
@@ -167,13 +167,23 @@ class RecordHandler {
167
167
  this._pruning = new Set()
168
168
 
169
169
  for (const rec of pruning) {
170
- rec._$dispose()
171
- this._records.delete(rec.name)
170
+ try {
171
+ rec._$dispose()
172
+ if (!this._records.delete(rec.name)) {
173
+ this._client._$onError(
174
+ C.TOPIC.RECORD,
175
+ C.EVENT.INTERNAL_ERROR,
176
+ `failed to delete pruned record: ${rec.name}`,
177
+ )
178
+ }
179
+ } catch (err) {
180
+ this._client._$onError(C.TOPIC.RECORD, C.EVENT.INTERNAL_ERROR, err)
181
+ }
172
182
  }
173
183
 
174
- this._stats.pruning -= pruning.size
175
- this._stats.records -= pruning.size
176
184
  this._stats.destroyed += pruning.size
185
+ this._stats.pruning = this._pruning.size
186
+ this._stats.records = this._records.size
177
187
 
178
188
  this._pruningTimeout.refresh()
179
189
  }
@@ -183,12 +193,11 @@ class RecordHandler {
183
193
 
184
194
  _onPruning(rec, value) {
185
195
  if (value) {
186
- this._stats.pruning += 1
187
196
  this._pruning.add(rec)
188
197
  } else {
189
- this._stats.pruning -= 1
190
198
  this._pruning.delete(rec)
191
199
  }
200
+ this._stats.pruning = this._pruning.size
192
201
  }
193
202
 
194
203
  _onUpdating(rec, value) {
@@ -211,17 +220,15 @@ class RecordHandler {
211
220
 
212
221
  _onPatching(rec, value) {
213
222
  if (value) {
214
- this._stats.patching += 1
215
223
  this._patching.set(rec, [])
216
224
  } else {
217
- this._stats.patching -= 1
218
-
219
225
  const callbacks = this._patching.get(rec)
220
226
  this._patching.delete(rec)
221
227
  for (const callback of callbacks) {
222
228
  callback()
223
229
  }
224
230
  }
231
+ this._stats.patching = this._patching.size
225
232
  }
226
233
 
227
234
  get connected() {
@@ -261,9 +268,9 @@ class RecordHandler {
261
268
  let record = this._records.get(name)
262
269
  if (!record) {
263
270
  record = new Record(name, this)
264
- this._stats.records += 1
265
- this._stats.created += 1
266
271
  this._records.set(name, record)
272
+ this._stats.created += 1
273
+ this._stats.records = this._records.size
267
274
  } else {
268
275
  record.ref()
269
276
  }