@hot-updater/plugin-core 1.2.0-rc.58 → 1.2.0-rc.59
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.
|
@@ -358,6 +358,7 @@ const createTransactions = ({ adapter, schema, reads, retry = {} }) => {
|
|
|
358
358
|
let negative;
|
|
359
359
|
let failures = 0;
|
|
360
360
|
let lost;
|
|
361
|
+
let busy = false;
|
|
361
362
|
for (let round = 0;; round += 1) {
|
|
362
363
|
const delay = round && Math.min(maxDelayMs, baseDelayMs * 2 ** (round - 1));
|
|
363
364
|
if (delay > 0) await new Promise((resolve) => setTimeout(resolve, delay / 2 + Math.random() * (delay / 2)));
|
|
@@ -368,6 +369,7 @@ const createTransactions = ({ adapter, schema, reads, retry = {} }) => {
|
|
|
368
369
|
if (run === void 0) {
|
|
369
370
|
onRetry?.("rerun", round + 1);
|
|
370
371
|
lost = void 0;
|
|
372
|
+
busy = false;
|
|
371
373
|
if ((failures += 1) >= attempts) break;
|
|
372
374
|
continue;
|
|
373
375
|
}
|
|
@@ -378,6 +380,7 @@ const createTransactions = ({ adapter, schema, reads, retry = {} }) => {
|
|
|
378
380
|
if (!(error instanceof require_engineAggregates.NegativeGaugeError)) throw error;
|
|
379
381
|
negative = error;
|
|
380
382
|
onRetry?.("rerun", round + 1);
|
|
383
|
+
busy = false;
|
|
381
384
|
run = void 0;
|
|
382
385
|
lost = void 0;
|
|
383
386
|
if ((failures += 1) >= attempts) break;
|
|
@@ -398,6 +401,7 @@ const createTransactions = ({ adapter, schema, reads, retry = {} }) => {
|
|
|
398
401
|
}
|
|
399
402
|
if (outcome.ok) return run.result;
|
|
400
403
|
const failed = "failedOp" in outcome ? outcome.failedOp : void 0;
|
|
404
|
+
busy = failed === void 0;
|
|
401
405
|
if (failed === void 0 || failed >= run.ops.length) {
|
|
402
406
|
onRetry?.("resend", round + 1);
|
|
403
407
|
failures += 1;
|
|
@@ -411,7 +415,7 @@ const createTransactions = ({ adapter, schema, reads, retry = {} }) => {
|
|
|
411
415
|
run = void 0;
|
|
412
416
|
if ((failures += 1) >= attempts) break;
|
|
413
417
|
}
|
|
414
|
-
throw negative ?? new require_errors.DatabaseConflictError(`The transaction conflicted ${attempts} times.`);
|
|
418
|
+
throw negative ?? new require_errors.DatabaseConflictError(busy ? `The database stayed busy through ${attempts} attempts of the transaction, as a store does at its throughput limit.` : `The transaction conflicted ${attempts} times.`);
|
|
415
419
|
} };
|
|
416
420
|
};
|
|
417
421
|
//#endregion
|
|
@@ -358,6 +358,7 @@ const createTransactions = ({ adapter, schema, reads, retry = {} }) => {
|
|
|
358
358
|
let negative;
|
|
359
359
|
let failures = 0;
|
|
360
360
|
let lost;
|
|
361
|
+
let busy = false;
|
|
361
362
|
for (let round = 0;; round += 1) {
|
|
362
363
|
const delay = round && Math.min(maxDelayMs, baseDelayMs * 2 ** (round - 1));
|
|
363
364
|
if (delay > 0) await new Promise((resolve) => setTimeout(resolve, delay / 2 + Math.random() * (delay / 2)));
|
|
@@ -368,6 +369,7 @@ const createTransactions = ({ adapter, schema, reads, retry = {} }) => {
|
|
|
368
369
|
if (run === void 0) {
|
|
369
370
|
onRetry?.("rerun", round + 1);
|
|
370
371
|
lost = void 0;
|
|
372
|
+
busy = false;
|
|
371
373
|
if ((failures += 1) >= attempts) break;
|
|
372
374
|
continue;
|
|
373
375
|
}
|
|
@@ -378,6 +380,7 @@ const createTransactions = ({ adapter, schema, reads, retry = {} }) => {
|
|
|
378
380
|
if (!(error instanceof NegativeGaugeError)) throw error;
|
|
379
381
|
negative = error;
|
|
380
382
|
onRetry?.("rerun", round + 1);
|
|
383
|
+
busy = false;
|
|
381
384
|
run = void 0;
|
|
382
385
|
lost = void 0;
|
|
383
386
|
if ((failures += 1) >= attempts) break;
|
|
@@ -398,6 +401,7 @@ const createTransactions = ({ adapter, schema, reads, retry = {} }) => {
|
|
|
398
401
|
}
|
|
399
402
|
if (outcome.ok) return run.result;
|
|
400
403
|
const failed = "failedOp" in outcome ? outcome.failedOp : void 0;
|
|
404
|
+
busy = failed === void 0;
|
|
401
405
|
if (failed === void 0 || failed >= run.ops.length) {
|
|
402
406
|
onRetry?.("resend", round + 1);
|
|
403
407
|
failures += 1;
|
|
@@ -411,7 +415,7 @@ const createTransactions = ({ adapter, schema, reads, retry = {} }) => {
|
|
|
411
415
|
run = void 0;
|
|
412
416
|
if ((failures += 1) >= attempts) break;
|
|
413
417
|
}
|
|
414
|
-
throw negative ?? new DatabaseConflictError(`The transaction conflicted ${attempts} times.`);
|
|
418
|
+
throw negative ?? new DatabaseConflictError(busy ? `The database stayed busy through ${attempts} attempts of the transaction, as a store does at its throughput limit.` : `The transaction conflicted ${attempts} times.`);
|
|
415
419
|
} };
|
|
416
420
|
};
|
|
417
421
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/plugin-core",
|
|
3
|
-
"version": "1.2.0-rc.
|
|
3
|
+
"version": "1.2.0-rc.59",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"es-toolkit": "^1.32.0",
|
|
46
46
|
"mime": "^4.0.4",
|
|
47
47
|
"verkit": "0.4.0",
|
|
48
|
-
"@hot-updater/protocol": "1.2.0-rc.
|
|
48
|
+
"@hot-updater/protocol": "1.2.0-rc.59"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@electric-sql/pglite": "0.4.1",
|