@nxtedition/deepstream.io-client-js 28.1.18 → 28.1.20
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 +37 -3
package/package.json
CHANGED
|
@@ -102,7 +102,7 @@ class RecordHandler {
|
|
|
102
102
|
this._pruning = new Set()
|
|
103
103
|
this._patching = new Map()
|
|
104
104
|
this._updating = new Map()
|
|
105
|
-
this._putting = new
|
|
105
|
+
this._putting = new Map()
|
|
106
106
|
|
|
107
107
|
this._connected = 0
|
|
108
108
|
this._stats = {
|
|
@@ -284,6 +284,40 @@ class RecordHandler {
|
|
|
284
284
|
|
|
285
285
|
signalPromise?.catch(noop)
|
|
286
286
|
|
|
287
|
+
if (this._putting.size) {
|
|
288
|
+
const promises = []
|
|
289
|
+
|
|
290
|
+
{
|
|
291
|
+
const puttingPromises = []
|
|
292
|
+
for (const callbacks of this._putting.values()) {
|
|
293
|
+
puttingPromises.push(new Promise((resolve) => callbacks.push(resolve)))
|
|
294
|
+
}
|
|
295
|
+
promises.push(puttingPromises)
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (timeout) {
|
|
299
|
+
promises.push(
|
|
300
|
+
new Promise((resolve) => {
|
|
301
|
+
const patchingTimeout = timers.setTimeout(() => {
|
|
302
|
+
this._client._$onError(
|
|
303
|
+
C.TOPIC.RECORD,
|
|
304
|
+
C.EVENT.TIMEOUT,
|
|
305
|
+
new Error('sync putting timeout'),
|
|
306
|
+
)
|
|
307
|
+
resolve(null)
|
|
308
|
+
}, timeout)
|
|
309
|
+
disposers.push(() => timers.clearTimeout(patchingTimeout))
|
|
310
|
+
}),
|
|
311
|
+
)
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
if (signalPromise) {
|
|
315
|
+
promises.push(signalPromise)
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
await Promise.race(promises)
|
|
319
|
+
}
|
|
320
|
+
|
|
287
321
|
if (this._patching.size) {
|
|
288
322
|
const promises = []
|
|
289
323
|
|
|
@@ -429,7 +463,7 @@ class RecordHandler {
|
|
|
429
463
|
const update = [name, version, jsonPath.stringify(data)]
|
|
430
464
|
this._connection.sendMsg(C.TOPIC.RECORD, C.ACTIONS.PUT, update)
|
|
431
465
|
|
|
432
|
-
this._putting.
|
|
466
|
+
this._putting.set(update, [])
|
|
433
467
|
this._sync((update) => {
|
|
434
468
|
this._putting.delete(update)
|
|
435
469
|
}, update)
|
|
@@ -694,7 +728,7 @@ class RecordHandler {
|
|
|
694
728
|
this._connection.sendMsg(C.TOPIC.RECORD, C.ACTIONS.SYNC, [token])
|
|
695
729
|
}
|
|
696
730
|
|
|
697
|
-
for (const update of this._putting) {
|
|
731
|
+
for (const update of this._putting.keys()) {
|
|
698
732
|
this._connection.sendMsg(C.TOPIC.RECORD, C.ACTIONS.PUT, update)
|
|
699
733
|
}
|
|
700
734
|
} else {
|