@unicitylabs/sphere-sdk 0.14.11-dev.2 → 0.14.11-dev.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/dist/connect/index.cjs +1 -1
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.js +1 -1
- package/dist/connect/index.js.map +1 -1
- package/dist/core/index.cjs +16 -3
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +16 -3
- package/dist/core/index.js.map +1 -1
- package/dist/impl/browser/connect/index.cjs +1 -1
- package/dist/impl/browser/connect/index.cjs.map +1 -1
- package/dist/impl/browser/connect/index.js +1 -1
- package/dist/impl/browser/connect/index.js.map +1 -1
- package/dist/index.cjs +16 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -3
- package/dist/index.js.map +1 -1
- package/dist/modules/payments-v2/index.cjs +16 -3
- package/dist/modules/payments-v2/index.cjs.map +1 -1
- package/dist/modules/payments-v2/index.js +16 -3
- package/dist/modules/payments-v2/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -3188,16 +3188,28 @@ var Receive = class {
|
|
|
3188
3188
|
this.unsubscribeWake?.();
|
|
3189
3189
|
this.unsubscribeWake = null;
|
|
3190
3190
|
}
|
|
3191
|
-
/**
|
|
3192
|
-
|
|
3191
|
+
/**
|
|
3192
|
+
* Flush what has been accepted, then ask for a mirror refresh — at most once
|
|
3193
|
+
* per REFRESH_INTERVAL_MS.
|
|
3194
|
+
*
|
|
3195
|
+
* The flush is not incidental. A `claimed` ack is what materializes a token
|
|
3196
|
+
* into SERVER inventory, and acks otherwise sit queued until ACK_BATCH_SIZE
|
|
3197
|
+
* (200) — so for any ordinary drain, including the 54-token case this exists
|
|
3198
|
+
* for, refreshing before the flush would query an inventory holding none of
|
|
3199
|
+
* the tokens just accepted, and the balance would still only move at the end.
|
|
3200
|
+
* Ordering is preserved: store() still precedes the ack (§5.7).
|
|
3201
|
+
*/
|
|
3202
|
+
async maybeRefresh(deps, pending, epochOf) {
|
|
3193
3203
|
if (deps.refreshView === void 0) return;
|
|
3194
3204
|
const now = deps.now?.() ?? Date.now();
|
|
3195
3205
|
if (now - this.lastRefreshAt < REFRESH_INTERVAL_MS) return;
|
|
3196
3206
|
this.lastRefreshAt = now;
|
|
3207
|
+
await flushAcks(deps, pending, epochOf);
|
|
3197
3208
|
deps.refreshView();
|
|
3198
3209
|
}
|
|
3199
3210
|
async doDrain() {
|
|
3200
3211
|
const deps = this.deps;
|
|
3212
|
+
this.lastRefreshAt = deps.now?.() ?? Date.now();
|
|
3201
3213
|
const engine = deps.engine();
|
|
3202
3214
|
const stored = [];
|
|
3203
3215
|
const pending = [];
|
|
@@ -3207,9 +3219,10 @@ var Receive = class {
|
|
|
3207
3219
|
let basis = record !== null && record.syncEpoch === deps.syncEpoch() ? record : null;
|
|
3208
3220
|
for (let pass = 0; pass < 2; pass++) {
|
|
3209
3221
|
for await (const entry of deps.delivery.incoming(basis === null ? void 0 : String(basis.cursor))) {
|
|
3222
|
+
const storedBefore = stored.length;
|
|
3210
3223
|
await this.processEntry(deps, engine, entry, pending, stored);
|
|
3211
3224
|
if (pending.length >= ACK_BATCH_SIZE) await flushAcks(deps, pending, pageEpoch);
|
|
3212
|
-
if (stored.length >
|
|
3225
|
+
if (stored.length > storedBefore) await this.maybeRefresh(deps, pending, pageEpoch);
|
|
3213
3226
|
}
|
|
3214
3227
|
await flushAcks(deps, pending, pageEpoch);
|
|
3215
3228
|
const served = deps.delivery.incomingEpoch();
|