@ercworldio/blockchain-shared 1.0.3-dev.3-PROJ-1296.27 → 1.0.3-dev.3-PROJ-1296.28
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScheduleTransactionService.d.ts","sourceRoot":"","sources":["../../../../src/services/db/timelock/ScheduleTransactionService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AACrG,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AAE5F,cAAM,0BAA0B;IAE5B,MAAM,CAAC,2BAA2B,GAAU,MAAM,IAAI,EAAE,QAAO,MAAW,EAAE,YAAW,MAAY,EAAE,gBAAe,oBAA0F,KAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"ScheduleTransactionService.d.ts","sourceRoot":"","sources":["../../../../src/services/db/timelock/ScheduleTransactionService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AACrG,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AAE5F,cAAM,0BAA0B;IAE5B,MAAM,CAAC,2BAA2B,GAAU,MAAM,IAAI,EAAE,QAAO,MAAW,EAAE,YAAW,MAAY,EAAE,gB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d;IAGF,MAAM,CAAC,aAAa,GAAU,MAAM,IAAI,EAAE,UAAU,uBAAuB,EAAE,KAAG,OAAO,CAAC,IAAI,CAAC,CAmB5F;CAEJ;AAED,eAAe,0BAA0B,CAAC"}
|
|
@@ -10,13 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
var _a;
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
const uuid_1 = require("uuid");
|
|
14
13
|
class ScheduleTransactionService {
|
|
15
14
|
}
|
|
16
15
|
_a = ScheduleTransactionService;
|
|
17
16
|
ScheduleTransactionService.get_and_lock_available_jobs = (pool_1, ...args_1) => __awaiter(void 0, [pool_1, ...args_1], void 0, function* (pool, limit = 10, job_ttl_s = 120, lock_metadata = { lock_owner: "schedule-tx-worker", lock_reason: "process_queued" }) {
|
|
18
17
|
const ttlSeconds = job_ttl_s;
|
|
19
|
-
const batchGroupId = (0, uuid_1.v4)();
|
|
20
18
|
const res = yield pool.query(`
|
|
21
19
|
WITH status_ids AS (
|
|
22
20
|
SELECT
|
|
@@ -38,27 +36,25 @@ ScheduleTransactionService.get_and_lock_available_jobs = (pool_1, ...args_1) =>
|
|
|
38
36
|
status_id = si.processing_id,
|
|
39
37
|
locked_at = now(),
|
|
40
38
|
lock_expires_at = now() + ($2 || ' seconds')::interval,
|
|
41
|
-
batch_group_id = $3,
|
|
42
39
|
metadata = jsonb_set(
|
|
43
40
|
jsonb_set(
|
|
44
41
|
coalesce(cj.metadata, '{}'::jsonb),
|
|
45
42
|
'{lock_owner}',
|
|
46
|
-
to_jsonb($
|
|
43
|
+
to_jsonb($3::text)
|
|
47
44
|
),
|
|
48
45
|
'{lock_reason}',
|
|
49
|
-
to_jsonb($
|
|
46
|
+
to_jsonb($4::text)
|
|
50
47
|
),
|
|
51
48
|
updated_at = now()
|
|
52
49
|
FROM candidates c, status_ids si
|
|
53
50
|
WHERE cj.id = c.id
|
|
54
51
|
RETURNING cj.*;
|
|
55
|
-
`, [limit, ttlSeconds,
|
|
52
|
+
`, [limit, ttlSeconds, lock_metadata.lock_owner, lock_metadata.lock_reason]);
|
|
56
53
|
return res.rows;
|
|
57
54
|
});
|
|
58
55
|
/** Same as get_available_jobs but joins withdrawal details from accounting for each job. */
|
|
59
56
|
ScheduleTransactionService.get_and_lock_available_jobs_with_details = (pool_1, ...args_1) => __awaiter(void 0, [pool_1, ...args_1], void 0, function* (pool, limit = 10, job_ttl_s = 120, lock_metadata = { lock_owner: "schedule-tx-worker", lock_reason: "process_queued" }) {
|
|
60
57
|
const ttlSeconds = job_ttl_s;
|
|
61
|
-
const batchGroupId = (0, uuid_1.v4)();
|
|
62
58
|
const res = yield pool.query(`
|
|
63
59
|
WITH status_ids AS (
|
|
64
60
|
SELECT
|
|
@@ -81,15 +77,14 @@ ScheduleTransactionService.get_and_lock_available_jobs_with_details = (pool_1, .
|
|
|
81
77
|
status_id = si.processing_id,
|
|
82
78
|
locked_at = now(),
|
|
83
79
|
lock_expires_at = now() + ($2 || ' seconds')::interval,
|
|
84
|
-
batch_group_id = $3,
|
|
85
80
|
metadata = jsonb_set(
|
|
86
81
|
jsonb_set(
|
|
87
82
|
coalesce(cj.metadata, '{}'::jsonb),
|
|
88
83
|
'{lock_owner}',
|
|
89
|
-
to_jsonb($
|
|
84
|
+
to_jsonb($3::text)
|
|
90
85
|
),
|
|
91
86
|
'{lock_reason}',
|
|
92
|
-
to_jsonb($
|
|
87
|
+
to_jsonb($4::text)
|
|
93
88
|
),
|
|
94
89
|
updated_at = now()
|
|
95
90
|
FROM candidates c, status_ids si
|
|
@@ -99,7 +94,7 @@ ScheduleTransactionService.get_and_lock_available_jobs_with_details = (pool_1, .
|
|
|
99
94
|
SELECT u.*, sjs.status, accounting.fn_get_crypto_withdrawal_details(u.request_id) AS withdrawal_details
|
|
100
95
|
FROM updated u
|
|
101
96
|
JOIN multisig.schedule_job_statuses sjs ON sjs.id = u.status_id
|
|
102
|
-
`, [limit, ttlSeconds,
|
|
97
|
+
`, [limit, ttlSeconds, lock_metadata.lock_owner, lock_metadata.lock_reason]);
|
|
103
98
|
return res.rows;
|
|
104
99
|
});
|
|
105
100
|
/**
|
package/package.json
CHANGED