@ocap/resolver 1.30.9 → 1.30.11
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/esm/index.mjs +9 -1
- package/lib/index.cjs +8 -0
- package/package.json +14 -14
package/esm/index.mjs
CHANGED
|
@@ -14,7 +14,7 @@ import * as Config from "@ocap/config";
|
|
|
14
14
|
import { types } from "@ocap/mcrypto";
|
|
15
15
|
import { fromTypeUrl } from "@ocap/message";
|
|
16
16
|
import * as states from "@ocap/state";
|
|
17
|
-
import { createExecutor } from "@ocap/tx-protocols";
|
|
17
|
+
import { TxTimer, createExecutor } from "@ocap/tx-protocols";
|
|
18
18
|
import { decodeAnySafe } from "@ocap/tx-protocols/lib/util";
|
|
19
19
|
import { DEFAULT_TOKEN_DECIMAL } from "@ocap/util/lib/constant";
|
|
20
20
|
import { CustomError } from "@ocap/util/lib/error";
|
|
@@ -293,6 +293,12 @@ var OCAPResolver = class {
|
|
|
293
293
|
if (process.env.CHAIN_MODE === "readonly") throw new CustomError("FORBIDDEN", "This chain node is running in readonly mode");
|
|
294
294
|
if (this.queue.length >= txRequestConfig.maxRequest) throw new CustomError("FORBIDDEN", "Chain is busy");
|
|
295
295
|
if (!txBase64 || typeof txBase64 !== "string" || txBase64.length < 20) throw new CustomError("INVALID_TX", "Transaction data is empty or too short");
|
|
296
|
+
const timer = new TxTimer();
|
|
297
|
+
timer.setQueueState({
|
|
298
|
+
waitingAtEnqueue: Math.max(0, this.queue.length - (this.queue.pending ?? 0)),
|
|
299
|
+
runningAtEnqueue: this.queue.pending ?? 0,
|
|
300
|
+
concurrencyConfig: txRequestConfig.concurrent
|
|
301
|
+
});
|
|
296
302
|
const context = {
|
|
297
303
|
txBase64,
|
|
298
304
|
statedb: this.statedb,
|
|
@@ -301,6 +307,7 @@ var OCAPResolver = class {
|
|
|
301
307
|
config: this.config,
|
|
302
308
|
filter: this.filter,
|
|
303
309
|
logger: this.logger,
|
|
310
|
+
timer,
|
|
304
311
|
extra: {
|
|
305
312
|
...ctx,
|
|
306
313
|
txExtra: extra
|
|
@@ -308,6 +315,7 @@ var OCAPResolver = class {
|
|
|
308
315
|
};
|
|
309
316
|
return new Promise((resolve, reject) => {
|
|
310
317
|
const task = async () => {
|
|
318
|
+
timer.mark("queueWait");
|
|
311
319
|
try {
|
|
312
320
|
await this.initializationPromise;
|
|
313
321
|
resolve((await this.executor.execute(context)).txHash);
|
package/lib/index.cjs
CHANGED
|
@@ -307,6 +307,12 @@ var OCAPResolver = class {
|
|
|
307
307
|
if (process.env.CHAIN_MODE === "readonly") throw new _ocap_util_lib_error.CustomError("FORBIDDEN", "This chain node is running in readonly mode");
|
|
308
308
|
if (this.queue.length >= txRequestConfig.maxRequest) throw new _ocap_util_lib_error.CustomError("FORBIDDEN", "Chain is busy");
|
|
309
309
|
if (!txBase64 || typeof txBase64 !== "string" || txBase64.length < 20) throw new _ocap_util_lib_error.CustomError("INVALID_TX", "Transaction data is empty or too short");
|
|
310
|
+
const timer = new _ocap_tx_protocols.TxTimer();
|
|
311
|
+
timer.setQueueState({
|
|
312
|
+
waitingAtEnqueue: Math.max(0, this.queue.length - (this.queue.pending ?? 0)),
|
|
313
|
+
runningAtEnqueue: this.queue.pending ?? 0,
|
|
314
|
+
concurrencyConfig: txRequestConfig.concurrent
|
|
315
|
+
});
|
|
310
316
|
const context = {
|
|
311
317
|
txBase64,
|
|
312
318
|
statedb: this.statedb,
|
|
@@ -315,6 +321,7 @@ var OCAPResolver = class {
|
|
|
315
321
|
config: this.config,
|
|
316
322
|
filter: this.filter,
|
|
317
323
|
logger: this.logger,
|
|
324
|
+
timer,
|
|
318
325
|
extra: {
|
|
319
326
|
...ctx,
|
|
320
327
|
txExtra: extra
|
|
@@ -322,6 +329,7 @@ var OCAPResolver = class {
|
|
|
322
329
|
};
|
|
323
330
|
return new Promise((resolve, reject) => {
|
|
324
331
|
const task = async () => {
|
|
332
|
+
timer.mark("queueWait");
|
|
325
333
|
try {
|
|
326
334
|
await this.initializationPromise;
|
|
327
335
|
resolve((await this.executor.execute(context)).txHash);
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.30.
|
|
6
|
+
"version": "1.30.11",
|
|
7
7
|
"description": "GraphQL resolver built upon ocap statedb and GQL layer",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"main": "./lib/index.cjs",
|
|
@@ -49,20 +49,20 @@
|
|
|
49
49
|
"tsdown": "^0.18.4"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@arcblock/did": "1.30.
|
|
53
|
-
"@arcblock/did-ext": "1.30.
|
|
54
|
-
"@arcblock/did-util": "1.30.
|
|
52
|
+
"@arcblock/did": "1.30.11",
|
|
53
|
+
"@arcblock/did-ext": "1.30.11",
|
|
54
|
+
"@arcblock/did-util": "1.30.11",
|
|
55
55
|
"@arcblock/nft-display": "^3.2.3",
|
|
56
|
-
"@arcblock/validator": "1.30.
|
|
57
|
-
"@ocap/config": "1.30.
|
|
58
|
-
"@ocap/indexdb": "1.30.
|
|
59
|
-
"@ocap/mcrypto": "1.30.
|
|
60
|
-
"@ocap/message": "1.30.
|
|
61
|
-
"@ocap/state": "1.30.
|
|
62
|
-
"@ocap/tx-protocols": "1.30.
|
|
63
|
-
"@ocap/types": "1.30.
|
|
64
|
-
"@ocap/util": "1.30.
|
|
65
|
-
"@ocap/wallet": "1.30.
|
|
56
|
+
"@arcblock/validator": "1.30.11",
|
|
57
|
+
"@ocap/config": "1.30.11",
|
|
58
|
+
"@ocap/indexdb": "1.30.11",
|
|
59
|
+
"@ocap/mcrypto": "1.30.11",
|
|
60
|
+
"@ocap/message": "1.30.11",
|
|
61
|
+
"@ocap/state": "1.30.11",
|
|
62
|
+
"@ocap/tx-protocols": "1.30.11",
|
|
63
|
+
"@ocap/types": "1.30.11",
|
|
64
|
+
"@ocap/util": "1.30.11",
|
|
65
|
+
"@ocap/wallet": "1.30.11",
|
|
66
66
|
"debug": "^4.4.3",
|
|
67
67
|
"express": "^4.22.1",
|
|
68
68
|
"lodash": "^4.17.23",
|