durability 5.1.0 → 5.2.0
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/README.md +145 -12
- package/dist/{durability-alarms.d.ts → alarms/index.d.ts} +13 -5
- package/dist/{durability-alarms.js → alarms/index.js} +69 -55
- package/dist/alarms/migrations.d.ts +9 -0
- package/dist/alarms/migrations.js +133 -0
- package/dist/experimental.d.ts +10 -10
- package/dist/experimental.js +7 -7
- package/dist/{fanout.d.ts → fanout/index.d.ts} +13 -6
- package/dist/{fanout.js → fanout/index.js} +54 -46
- package/dist/fanout/migrations.d.ts +9 -0
- package/dist/fanout/migrations.js +181 -0
- package/dist/{stored-message.d.ts → fanout/stored-message.d.ts} +1 -1
- package/dist/index.d.ts +14 -9
- package/dist/index.js +13 -8
- package/dist/{log.d.ts → log/index.d.ts} +15 -3
- package/dist/{log.js → log/index.js} +152 -124
- package/dist/log/migrations.d.ts +18 -0
- package/dist/log/migrations.js +297 -0
- package/dist/{memoize.d.ts → memoize/index.d.ts} +1 -1
- package/dist/{memoize.js → memoize/index.js} +14 -11
- package/dist/memoize/migrations.d.ts +10 -0
- package/dist/memoize/migrations.js +21 -0
- package/dist/migrations.d.ts +0 -111
- package/dist/migrations.js +0 -612
- package/dist/{durability.d.ts → operations/index.d.ts} +13 -5
- package/dist/{durability.js → operations/index.js} +59 -47
- package/dist/operations/migrations.d.ts +10 -0
- package/dist/operations/migrations.js +150 -0
- package/dist/{outbox.d.ts → outbox/index.d.ts} +4 -4
- package/dist/{outbox.js → outbox/index.js} +16 -60
- package/dist/outbox/migrations.d.ts +9 -0
- package/dist/outbox/migrations.js +43 -0
- package/dist/{routing-client.js → routing/client.js} +1 -1
- package/dist/{routing.d.ts → routing/index.d.ts} +3 -3
- package/dist/{routing.js → routing/index.js} +3 -3
- package/dist/{load.d.ts → routing/load.d.ts} +1 -1
- package/dist/{schedule.d.ts → schedule/index.d.ts} +16 -8
- package/dist/{schedule.js → schedule/index.js} +65 -49
- package/dist/schedule/migrations.d.ts +9 -0
- package/dist/schedule/migrations.js +118 -0
- package/dist/{scheduler.d.ts → scheduler/index.d.ts} +75 -25
- package/dist/{scheduler.js → scheduler/index.js} +300 -63
- package/dist/{semaphore-client.d.ts → semaphore/client.d.ts} +1 -1
- package/dist/{semaphore-client.js → semaphore/client.js} +2 -2
- package/dist/{semaphore.d.ts → semaphore/index.d.ts} +10 -10
- package/dist/{semaphore.js → semaphore/index.js} +7 -7
- package/dist/{semaphore-leases.d.ts → semaphore/leases.d.ts} +17 -6
- package/dist/{semaphore-leases.js → semaphore/leases.js} +28 -12
- package/dist/semaphore/migrations.d.ts +18 -0
- package/dist/semaphore/migrations.js +444 -0
- package/dist/{semaphore-protocol.d.ts → semaphore/protocol.d.ts} +16 -8
- package/dist/{semaphore-protocol.js → semaphore/protocol.js} +37 -14
- package/dist/{semaphore-queue-store.d.ts → semaphore/queue-store.d.ts} +12 -6
- package/dist/{semaphore-queue-store.js → semaphore/queue-store.js} +69 -61
- package/dist/{semaphore-queue.d.ts → semaphore/queue.d.ts} +15 -5
- package/dist/{semaphore-queue.js → semaphore/queue.js} +105 -46
- package/dist/{semaphore-server.d.ts → semaphore/server.d.ts} +12 -4
- package/dist/{semaphore-server.js → semaphore/server.js} +51 -24
- package/dist/{semaphore-store.d.ts → semaphore/store.d.ts} +8 -3
- package/dist/{semaphore-store.js → semaphore/store.js} +35 -33
- package/dist/{client.d.ts → socket/client.d.ts} +3 -3
- package/dist/{client.js → socket/client.js} +4 -4
- package/dist/{socket.d.ts → socket/index.d.ts} +15 -4
- package/dist/{socket.js → socket/index.js} +66 -20
- package/dist/socket/migrations.d.ts +9 -0
- package/dist/socket/migrations.js +57 -0
- package/dist/{socket-protocol.d.ts → socket/protocol.d.ts} +1 -1
- package/dist/storage.d.ts +4 -0
- package/dist/storage.js +13 -6
- package/dist/{topology-client.d.ts → topology/client.d.ts} +2 -2
- package/dist/{topology-client.js → topology/client.js} +3 -3
- package/dist/{topology.d.ts → topology/index.d.ts} +17 -7
- package/dist/{topology.js → topology/index.js} +92 -58
- package/dist/topology/migrations.d.ts +10 -0
- package/dist/topology/migrations.js +138 -0
- package/dist/{tracker.d.ts → tracker/index.d.ts} +3 -3
- package/dist/{tracker.js → tracker/index.js} +2 -2
- package/package.json +11 -11
- /package/dist/{stored-message.js → fanout/stored-message.js} +0 -0
- /package/dist/{routing-client.d.ts → routing/client.d.ts} +0 -0
- /package/dist/{load.js → routing/load.js} +0 -0
- /package/dist/{socket-protocol.js → socket/protocol.js} +0 -0
- /package/dist/{topology-snapshot.d.ts → topology/snapshot.d.ts} +0 -0
- /package/dist/{topology-snapshot.js → topology/snapshot.js} +0 -0
- /package/dist/{tracked-source.d.ts → tracker/source.d.ts} +0 -0
- /package/dist/{tracked-source.js → tracker/source.js} +0 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ordered SQLite migrations for the `durability_alarms` table owned by
|
|
3
|
+
* {@link DurabilityAlarms}. Applied automatically on construction.
|
|
4
|
+
*/
|
|
5
|
+
export const durabilityNamedAlarmMigrations = [
|
|
6
|
+
{
|
|
7
|
+
name: 'durability_0003_create_alarms',
|
|
8
|
+
up: `
|
|
9
|
+
CREATE TABLE IF NOT EXISTS durability_alarms (
|
|
10
|
+
name TEXT PRIMARY KEY,
|
|
11
|
+
generation_id TEXT NOT NULL,
|
|
12
|
+
status TEXT NOT NULL CHECK (status IN ('pending', 'failed')),
|
|
13
|
+
scheduled_at INTEGER NOT NULL,
|
|
14
|
+
next_attempt_at INTEGER NOT NULL,
|
|
15
|
+
attempt INTEGER NOT NULL DEFAULT 0,
|
|
16
|
+
last_error TEXT,
|
|
17
|
+
last_error_name TEXT
|
|
18
|
+
);
|
|
19
|
+
CREATE INDEX IF NOT EXISTS durability_alarms_pending_idx
|
|
20
|
+
ON durability_alarms (status, next_attempt_at);
|
|
21
|
+
`,
|
|
22
|
+
down: `
|
|
23
|
+
DROP INDEX IF EXISTS durability_alarms_pending_idx;
|
|
24
|
+
DROP TABLE IF EXISTS durability_alarms;
|
|
25
|
+
`,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'durability_0004_alarms_generation_and_created_at',
|
|
29
|
+
up: `
|
|
30
|
+
DROP INDEX IF EXISTS durability_alarms_pending_idx;
|
|
31
|
+
ALTER TABLE durability_alarms RENAME TO durability_alarms_v3;
|
|
32
|
+
CREATE TABLE durability_alarms (
|
|
33
|
+
name TEXT PRIMARY KEY,
|
|
34
|
+
generation_id TEXT NOT NULL,
|
|
35
|
+
status TEXT NOT NULL CHECK (status IN ('pending', 'failed')),
|
|
36
|
+
scheduled_at INTEGER NOT NULL,
|
|
37
|
+
next_attempt_at INTEGER NOT NULL,
|
|
38
|
+
attempt INTEGER NOT NULL DEFAULT 0,
|
|
39
|
+
last_error TEXT,
|
|
40
|
+
last_error_name TEXT,
|
|
41
|
+
created_at INTEGER NOT NULL DEFAULT (CAST(unixepoch('subsec') * 1000 AS INTEGER))
|
|
42
|
+
);
|
|
43
|
+
INSERT INTO durability_alarms
|
|
44
|
+
SELECT name, generation_id, status, scheduled_at, next_attempt_at,
|
|
45
|
+
attempt, last_error, last_error_name,
|
|
46
|
+
CAST(unixepoch('subsec') * 1000 AS INTEGER)
|
|
47
|
+
FROM durability_alarms_v3;
|
|
48
|
+
DROP TABLE durability_alarms_v3;
|
|
49
|
+
CREATE INDEX durability_alarms_pending_idx
|
|
50
|
+
ON durability_alarms (status, next_attempt_at);
|
|
51
|
+
CREATE INDEX durability_alarms_created_idx
|
|
52
|
+
ON durability_alarms (created_at);
|
|
53
|
+
`,
|
|
54
|
+
down: `
|
|
55
|
+
DROP INDEX IF EXISTS durability_alarms_pending_idx;
|
|
56
|
+
DROP INDEX IF EXISTS durability_alarms_created_idx;
|
|
57
|
+
ALTER TABLE durability_alarms RENAME TO durability_alarms_v4;
|
|
58
|
+
CREATE TABLE durability_alarms (
|
|
59
|
+
name TEXT PRIMARY KEY,
|
|
60
|
+
generation_id TEXT NOT NULL,
|
|
61
|
+
status TEXT NOT NULL CHECK (status IN ('pending', 'failed')),
|
|
62
|
+
scheduled_at INTEGER NOT NULL,
|
|
63
|
+
next_attempt_at INTEGER NOT NULL,
|
|
64
|
+
attempt INTEGER NOT NULL DEFAULT 0,
|
|
65
|
+
last_error TEXT,
|
|
66
|
+
last_error_name TEXT
|
|
67
|
+
);
|
|
68
|
+
INSERT INTO durability_alarms
|
|
69
|
+
SELECT name, generation_id, status, scheduled_at, next_attempt_at,
|
|
70
|
+
attempt, last_error, last_error_name
|
|
71
|
+
FROM durability_alarms_v4;
|
|
72
|
+
DROP TABLE durability_alarms_v4;
|
|
73
|
+
CREATE INDEX durability_alarms_pending_idx
|
|
74
|
+
ON durability_alarms (status, next_attempt_at);
|
|
75
|
+
`,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'durability_0016_alarms_channel',
|
|
79
|
+
up: `
|
|
80
|
+
ALTER TABLE durability_alarms RENAME TO durability_alarms_before_channels;
|
|
81
|
+
CREATE TABLE durability_alarms (
|
|
82
|
+
name TEXT NOT NULL,
|
|
83
|
+
generation_id TEXT NOT NULL,
|
|
84
|
+
status TEXT NOT NULL CHECK (status IN ('pending', 'failed')),
|
|
85
|
+
scheduled_at INTEGER NOT NULL,
|
|
86
|
+
next_attempt_at INTEGER NOT NULL,
|
|
87
|
+
attempt INTEGER NOT NULL DEFAULT 0,
|
|
88
|
+
last_error TEXT,
|
|
89
|
+
last_error_name TEXT,
|
|
90
|
+
created_at INTEGER NOT NULL DEFAULT (CAST(unixepoch('subsec') * 1000 AS INTEGER)),
|
|
91
|
+
channel TEXT NOT NULL DEFAULT 'default',
|
|
92
|
+
PRIMARY KEY (channel, name)
|
|
93
|
+
);
|
|
94
|
+
INSERT INTO durability_alarms
|
|
95
|
+
SELECT *, 'default' FROM durability_alarms_before_channels;
|
|
96
|
+
DROP TABLE durability_alarms_before_channels;
|
|
97
|
+
CREATE INDEX durability_alarms_pending_idx
|
|
98
|
+
ON durability_alarms (status, next_attempt_at);
|
|
99
|
+
CREATE INDEX durability_alarms_created_idx
|
|
100
|
+
ON durability_alarms (created_at);
|
|
101
|
+
CREATE INDEX durability_alarms_channel_pending_idx
|
|
102
|
+
ON durability_alarms (channel, status, next_attempt_at);
|
|
103
|
+
`,
|
|
104
|
+
down: `
|
|
105
|
+
CREATE TABLE durability_alarms_channel_guard (
|
|
106
|
+
channel TEXT CONSTRAINT cannot_downgrade_nondefault_channels CHECK (channel = 'default')
|
|
107
|
+
);
|
|
108
|
+
INSERT INTO durability_alarms_channel_guard SELECT DISTINCT channel FROM durability_alarms;
|
|
109
|
+
DROP TABLE durability_alarms_channel_guard;
|
|
110
|
+
ALTER TABLE durability_alarms RENAME TO durability_alarms_with_channels;
|
|
111
|
+
CREATE TABLE durability_alarms (
|
|
112
|
+
name TEXT PRIMARY KEY,
|
|
113
|
+
generation_id TEXT NOT NULL,
|
|
114
|
+
status TEXT NOT NULL CHECK (status IN ('pending', 'failed')),
|
|
115
|
+
scheduled_at INTEGER NOT NULL,
|
|
116
|
+
next_attempt_at INTEGER NOT NULL,
|
|
117
|
+
attempt INTEGER NOT NULL DEFAULT 0,
|
|
118
|
+
last_error TEXT,
|
|
119
|
+
last_error_name TEXT,
|
|
120
|
+
created_at INTEGER NOT NULL DEFAULT (CAST(unixepoch('subsec') * 1000 AS INTEGER))
|
|
121
|
+
);
|
|
122
|
+
INSERT INTO durability_alarms
|
|
123
|
+
SELECT name, generation_id, status, scheduled_at, next_attempt_at,
|
|
124
|
+
attempt, last_error, last_error_name, created_at
|
|
125
|
+
FROM durability_alarms_with_channels;
|
|
126
|
+
DROP TABLE durability_alarms_with_channels;
|
|
127
|
+
CREATE INDEX durability_alarms_pending_idx
|
|
128
|
+
ON durability_alarms (status, next_attempt_at);
|
|
129
|
+
CREATE INDEX durability_alarms_created_idx
|
|
130
|
+
ON durability_alarms (created_at);
|
|
131
|
+
`,
|
|
132
|
+
},
|
|
133
|
+
];
|
package/dist/experimental.d.ts
CHANGED
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @packageDocumentation
|
|
6
6
|
*/
|
|
7
|
-
export { DurabilityTracker, type DurabilityTrackerConfig, type TrackedHandle, type TrackedItem, type TrackedResult, type TrackedWaitOptions, type TrackerHandle, type TrackerPage, type TrackerQuery, type TrackerRecord, type TrackerRecordPage, } from './tracker.js';
|
|
8
|
-
export type { TrackedEntry, TrackedPage, TrackedQuery, TrackedRecord, TrackedResults, TrackedSource, TrackedState, TrackedStatus, } from './
|
|
9
|
-
export { DurabilityOutbox, type DurabilityOutboxConfig, type DurabilityOutboxEvent, type OutboxEntry, } from './outbox.js';
|
|
7
|
+
export { DurabilityTracker, type DurabilityTrackerConfig, type TrackedHandle, type TrackedItem, type TrackedResult, type TrackedWaitOptions, type TrackerHandle, type TrackerPage, type TrackerQuery, type TrackerRecord, type TrackerRecordPage, } from './tracker/index.js';
|
|
8
|
+
export type { TrackedEntry, TrackedPage, TrackedQuery, TrackedRecord, TrackedResults, TrackedSource, TrackedState, TrackedStatus, } from './tracker/source.js';
|
|
9
|
+
export { DurabilityOutbox, type DurabilityOutboxConfig, type DurabilityOutboxEvent, type OutboxEntry, } from './outbox/index.js';
|
|
10
10
|
export { OutboxTimeoutError } from './errors.js';
|
|
11
|
-
export { durabilityOutboxMigrations } from './migrations.js';
|
|
12
|
-
export { DurabilityTopology, type DurabilityTopologyConfig, type DurabilityTopologyEvent, type TopologyChannel, type TopologyCurrent, type TopologyDraft, type TopologyPublisher, type TopologyRetryOptions, type TopologyRole, type TopologyStateUpdate, } from './topology.js';
|
|
13
|
-
export type { TopologyClient, TopologyClientConfig, TopologySource, TopologyView, } from './topology
|
|
14
|
-
export type { TopologyMember, TopologyMemberInput, TopologyMemberState, TopologySnapshot, } from './topology
|
|
11
|
+
export { durabilityOutboxMigrations } from './outbox/migrations.js';
|
|
12
|
+
export { DurabilityTopology, type DurabilityTopologyConfig, type DurabilityTopologyEvent, type TopologyChannel, type TopologyCurrent, type TopologyDraft, type TopologyPublisher, type TopologyRetryOptions, type TopologyRole, type TopologyStateUpdate, } from './topology/index.js';
|
|
13
|
+
export type { TopologyClient, TopologyClientConfig, TopologySource, TopologyView, } from './topology/client.js';
|
|
14
|
+
export type { TopologyMember, TopologyMemberInput, TopologyMemberState, TopologySnapshot, } from './topology/snapshot.js';
|
|
15
15
|
export { TopologyError, TopologyUnavailableError, type TopologyFallbackReason, } from './errors.js';
|
|
16
|
-
export { durabilityTopologyMigrations } from './migrations.js';
|
|
17
|
-
export { DurabilitySchedule, type DurabilityScheduleConfig, type DurabilityScheduleEvent, type ScheduleDefinition, type ScheduledOutcomeDelivery, type ScheduledRun, type ScheduledRunContext, type ScheduledRunOutcome, type ScheduleState, } from './schedule.js';
|
|
16
|
+
export { durabilityTopologyMigrations } from './topology/migrations.js';
|
|
17
|
+
export { DurabilitySchedule, type DurabilityScheduleConfig, type DurabilityScheduleEvent, type ScheduleDefinition, type ScheduledOutcomeDelivery, type ScheduledRun, type ScheduledRunContext, type ScheduledRunOutcome, type ScheduleState, } from './schedule/index.js';
|
|
18
18
|
export { ScheduledOutcomeTimeoutError, ScheduledRunInterruptedError, ScheduledRunTimeoutError, } from './errors.js';
|
|
19
|
-
export { durabilityScheduleMigrations } from './migrations.js';
|
|
19
|
+
export { durabilityScheduleMigrations } from './schedule/migrations.js';
|
package/dist/experimental.js
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @packageDocumentation
|
|
6
6
|
*/
|
|
7
|
-
export { DurabilityTracker, } from './tracker.js';
|
|
8
|
-
export { DurabilityOutbox, } from './outbox.js';
|
|
7
|
+
export { DurabilityTracker, } from './tracker/index.js';
|
|
8
|
+
export { DurabilityOutbox, } from './outbox/index.js';
|
|
9
9
|
export { OutboxTimeoutError } from './errors.js';
|
|
10
|
-
export { durabilityOutboxMigrations } from './migrations.js';
|
|
11
|
-
export { DurabilityTopology, } from './topology.js';
|
|
10
|
+
export { durabilityOutboxMigrations } from './outbox/migrations.js';
|
|
11
|
+
export { DurabilityTopology, } from './topology/index.js';
|
|
12
12
|
export { TopologyError, TopologyUnavailableError, } from './errors.js';
|
|
13
|
-
export { durabilityTopologyMigrations } from './migrations.js';
|
|
14
|
-
export { DurabilitySchedule, } from './schedule.js';
|
|
13
|
+
export { durabilityTopologyMigrations } from './topology/migrations.js';
|
|
14
|
+
export { DurabilitySchedule, } from './schedule/index.js';
|
|
15
15
|
export { ScheduledOutcomeTimeoutError, ScheduledRunInterruptedError, ScheduledRunTimeoutError, } from './errors.js';
|
|
16
|
-
export { durabilityScheduleMigrations } from './migrations.js';
|
|
16
|
+
export { durabilityScheduleMigrations } from './schedule/migrations.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type DurabilityLifecycleEvent, type LifecycleHook } from '
|
|
2
|
-
import { RoutingLoad, type EnqueueResult, type LoadSnapshot } from '
|
|
1
|
+
import { type DurabilityLifecycleEvent, type LifecycleHook } from '../lifecycle.js';
|
|
2
|
+
import { RoutingLoad, type EnqueueResult, type LoadSnapshot } from '../routing/load.js';
|
|
3
3
|
import type { MessageWrite } from './stored-message.js';
|
|
4
|
-
import { type DurableMemoize } from '
|
|
5
|
-
import { type ExecutionPolicyOptions } from '
|
|
6
|
-
import { type SchedulerAttachment } from '
|
|
4
|
+
import { type DurableMemoize } from '../memoize/index.js';
|
|
5
|
+
import { type ExecutionPolicyOptions } from '../policy.js';
|
|
6
|
+
import { type SchedulerAttachment } from '../scheduler/index.js';
|
|
7
7
|
export type FanoutInput<Body = unknown> = {
|
|
8
8
|
id?: string;
|
|
9
9
|
body: Body;
|
|
@@ -46,6 +46,13 @@ export type FanoutEnqueueOptions = {
|
|
|
46
46
|
targets?: readonly string[];
|
|
47
47
|
};
|
|
48
48
|
export type DurabilityFanoutConfig<Body> = SchedulerAttachment & ExecutionPolicyOptions & {
|
|
49
|
+
/**
|
|
50
|
+
* Stable channel ID. Instances on one scheduler share storage, partitioned
|
|
51
|
+
* by channel; target IDs and deduplication keys are independent in each
|
|
52
|
+
* channel, so a library can attach its own fanout beside the application's.
|
|
53
|
+
* Defaults to `default`.
|
|
54
|
+
*/
|
|
55
|
+
channel?: string;
|
|
49
56
|
targets: Record<string, FanoutTarget<Body>>;
|
|
50
57
|
routing?: RoutingLoad;
|
|
51
58
|
/** Receives terminal failures. Without it, terminal deliveries are dropped. */
|
|
@@ -72,7 +79,7 @@ export type DurabilityFanoutEvent = Extract<DurabilityLifecycleEvent, {
|
|
|
72
79
|
export declare class DurabilityFanout<Body = unknown> {
|
|
73
80
|
#private;
|
|
74
81
|
constructor(config: DurabilityFanoutConfig<Body>);
|
|
75
|
-
static migrate(context: Pick<DurableObjectState, 'storage'>, target?: string | null): import("
|
|
82
|
+
static migrate(context: Pick<DurableObjectState, 'storage'>, target?: string | null): import("../migrations.js").DurabilityMigrationResult;
|
|
76
83
|
alarm(info?: AlarmInvocationInfo): Promise<void>;
|
|
77
84
|
/**
|
|
78
85
|
* Attaches a best-effort lifecycle hook alongside `onLifecycleEvent` and
|
|
@@ -9,18 +9,20 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var _DurabilityFanout_instances, _DurabilityFanout_engine, _DurabilityFanout_routing, _DurabilityFanout_targets, _DurabilityFanout_policies, _DurabilityFanout_dlq, _DurabilityFanout_maxBatchSize, _DurabilityFanout_batchDelayMs, _DurabilityFanout_lifecycle, _DurabilityFanout_emit, _DurabilityFanout_running, _DurabilityFanout_pending, _DurabilityFanout_firstAttemptAt, _DurabilityFanout_runDue, _DurabilityFanout_runTarget, _DurabilityFanout_postpone, _DurabilityFanout_deliver, _DurabilityFanout_ackUnsettled, _DurabilityFanout_message, _DurabilityFanout_remove, _DurabilityFanout_removeDelivery, _DurabilityFanout_retry, _DurabilityFanout_deadLetter, _DurabilityFanout_emitTerminal, _DurabilityFanout_transaction, _DurabilityFanout_pendingCount, _DurabilityFanout_adjustPending, _DurabilityFanout_listDue, _DurabilityFanout_deadline;
|
|
12
|
+
var _DurabilityFanout_instances, _DurabilityFanout_engine, _DurabilityFanout_channel, _DurabilityFanout_table, _DurabilityFanout_routing, _DurabilityFanout_targets, _DurabilityFanout_policies, _DurabilityFanout_dlq, _DurabilityFanout_maxBatchSize, _DurabilityFanout_batchDelayMs, _DurabilityFanout_lifecycle, _DurabilityFanout_emit, _DurabilityFanout_running, _DurabilityFanout_pending, _DurabilityFanout_firstAttemptAt, _DurabilityFanout_runDue, _DurabilityFanout_runTarget, _DurabilityFanout_postpone, _DurabilityFanout_deliver, _DurabilityFanout_ackUnsettled, _DurabilityFanout_message, _DurabilityFanout_remove, _DurabilityFanout_removeDelivery, _DurabilityFanout_retry, _DurabilityFanout_deadLetter, _DurabilityFanout_emitTerminal, _DurabilityFanout_transaction, _DurabilityFanout_pendingCount, _DurabilityFanout_adjustPending, _DurabilityFanout_listDue, _DurabilityFanout_deadline;
|
|
13
13
|
import { z } from 'zod';
|
|
14
|
-
import { traceFunction, traceMethods } from '
|
|
15
|
-
import { DurableRetryPolicyError, FanoutEnqueueError, FanoutSettlementError, FanoutTimeoutError, reportFailure, serializeError, } from '
|
|
16
|
-
import { createLifecycleHooks, } from '
|
|
17
|
-
import { RoutingLoad } from '
|
|
18
|
-
import { createMemoize, deleteMemos, deleteMemosOfDroppedTable, } from '
|
|
19
|
-
import { durabilityFanoutMigrations
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
14
|
+
import { traceFunction, traceMethods } from '../dev.js';
|
|
15
|
+
import { DurableRetryPolicyError, FanoutEnqueueError, FanoutSettlementError, FanoutTimeoutError, reportFailure, serializeError, } from '../errors.js';
|
|
16
|
+
import { createLifecycleHooks, } from '../lifecycle.js';
|
|
17
|
+
import { RoutingLoad, } from '../routing/load.js';
|
|
18
|
+
import { createMemoize, deleteMemos, deleteMemosOfDroppedTable, } from '../memoize/index.js';
|
|
19
|
+
import { durabilityFanoutMigrations } from './migrations.js';
|
|
20
|
+
import { durabilityMemoMigrations } from '../memoize/migrations.js';
|
|
21
|
+
import { migrateCapability } from '../migrations.js';
|
|
22
|
+
import { assertPositiveInteger, createPolicyResolver, methodOptionsSchema, } from '../policy.js';
|
|
23
|
+
import { assertChannel, defaultChannel, engineFor, } from '../scheduler/index.js';
|
|
24
|
+
import { deserialize, serialize } from '../serialization.js';
|
|
25
|
+
import { claimAttempt, deleteAttempt, updateAttempt, } from '../storage.js';
|
|
24
26
|
const fanoutMessageRowSchema = z.object({
|
|
25
27
|
key: z.string(),
|
|
26
28
|
id: z.string(),
|
|
@@ -53,10 +55,10 @@ const deliveriesTable = {
|
|
|
53
55
|
};
|
|
54
56
|
const countRowSchema = z.object({ count: z.number().int().nonnegative() });
|
|
55
57
|
const seqRowSchema = z.object({ seq: z.number().int().nonnegative() });
|
|
56
|
-
const readManifest = (sql, key) => fanoutMessageRowSchema
|
|
58
|
+
const readManifest = (sql, channel, key) => fanoutMessageRowSchema
|
|
57
59
|
.optional()
|
|
58
60
|
.parse(sql
|
|
59
|
-
.exec('SELECT * FROM durability_fanout_messages WHERE key = ?', key)
|
|
61
|
+
.exec('SELECT * FROM durability_fanout_messages WHERE channel = ? AND key = ?', channel, key)
|
|
60
62
|
.toArray()[0]);
|
|
61
63
|
const attemptOf = (row) => ({
|
|
62
64
|
key: row.id,
|
|
@@ -80,6 +82,8 @@ export class DurabilityFanout {
|
|
|
80
82
|
constructor(config) {
|
|
81
83
|
_DurabilityFanout_instances.add(this);
|
|
82
84
|
_DurabilityFanout_engine.set(this, void 0);
|
|
85
|
+
_DurabilityFanout_channel.set(this, void 0);
|
|
86
|
+
_DurabilityFanout_table.set(this, void 0);
|
|
83
87
|
_DurabilityFanout_routing.set(this, void 0);
|
|
84
88
|
_DurabilityFanout_targets.set(this, void 0);
|
|
85
89
|
_DurabilityFanout_policies.set(this, void 0);
|
|
@@ -96,6 +100,8 @@ export class DurabilityFanout {
|
|
|
96
100
|
* may leave it wrong, so it is discarded and recounted on the next read.
|
|
97
101
|
*/
|
|
98
102
|
_DurabilityFanout_pending.set(this, void 0);
|
|
103
|
+
__classPrivateFieldSet(this, _DurabilityFanout_channel, assertChannel('DurabilityFanout', config.channel ?? defaultChannel), "f");
|
|
104
|
+
__classPrivateFieldSet(this, _DurabilityFanout_table, { ...deliveriesTable, channel: __classPrivateFieldGet(this, _DurabilityFanout_channel, "f") }, "f");
|
|
99
105
|
__classPrivateFieldSet(this, _DurabilityFanout_maxBatchSize, config.maxBatchSize ?? 10, "f");
|
|
100
106
|
assertPositiveInteger('maxBatchSize', __classPrivateFieldGet(this, _DurabilityFanout_maxBatchSize, "f"));
|
|
101
107
|
__classPrivateFieldSet(this, _DurabilityFanout_batchDelayMs, config.batchDelayMs ?? 0, "f");
|
|
@@ -122,8 +128,10 @@ export class DurabilityFanout {
|
|
|
122
128
|
__classPrivateFieldSet(this, _DurabilityFanout_emit, __classPrivateFieldGet(this, _DurabilityFanout_lifecycle, "f").emit, "f");
|
|
123
129
|
__classPrivateFieldGet(this, _DurabilityFanout_engine, "f").migrateSchema('fanout', durabilityFanoutMigrations);
|
|
124
130
|
__classPrivateFieldGet(this, _DurabilityFanout_engine, "f").migrateSchema('memos', durabilityMemoMigrations);
|
|
125
|
-
__classPrivateFieldGet(this, _DurabilityFanout_engine, "f").
|
|
126
|
-
table:
|
|
131
|
+
__classPrivateFieldGet(this, _DurabilityFanout_engine, "f").registerChannel({
|
|
132
|
+
table: __classPrivateFieldGet(this, _DurabilityFanout_table, "f"),
|
|
133
|
+
channel: __classPrivateFieldGet(this, _DurabilityFanout_channel, "f"),
|
|
134
|
+
helper: 'DurabilityFanout',
|
|
127
135
|
runDue: () => __classPrivateFieldGet(this, _DurabilityFanout_instances, "m", _DurabilityFanout_runDue).call(this),
|
|
128
136
|
});
|
|
129
137
|
}
|
|
@@ -187,7 +195,7 @@ export class DurabilityFanout {
|
|
|
187
195
|
registered = await __classPrivateFieldGet(this, _DurabilityFanout_instances, "m", _DurabilityFanout_transaction).call(this, (sql) => {
|
|
188
196
|
const claims = [];
|
|
189
197
|
for (const entry of entries) {
|
|
190
|
-
const existing = readManifest(sql, entry.key);
|
|
198
|
+
const existing = readManifest(sql, __classPrivateFieldGet(this, _DurabilityFanout_channel, "f"), entry.key);
|
|
191
199
|
if (existing) {
|
|
192
200
|
if (existing.id !== entry.id ||
|
|
193
201
|
existing.payload !== entry.payload ||
|
|
@@ -211,9 +219,9 @@ export class DurabilityFanout {
|
|
|
211
219
|
generation_id: crypto.randomUUID(),
|
|
212
220
|
};
|
|
213
221
|
sql.exec(`INSERT INTO durability_fanout_messages
|
|
214
|
-
(key, id, payload, targets, remaining, seq,
|
|
215
|
-
generation_id)
|
|
216
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`, message.key, message.id, message.payload, message.targets, message.remaining, message.seq, message.created_at, message.generation_id);
|
|
222
|
+
(channel, key, id, payload, targets, remaining, seq,
|
|
223
|
+
created_at, generation_id)
|
|
224
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`, __classPrivateFieldGet(this, _DurabilityFanout_channel, "f"), message.key, message.id, message.payload, message.targets, message.remaining, message.seq, message.created_at, message.generation_id);
|
|
217
225
|
for (const target of targets) {
|
|
218
226
|
const row = {
|
|
219
227
|
id: JSON.stringify([entry.key, target]),
|
|
@@ -233,11 +241,11 @@ export class DurabilityFanout {
|
|
|
233
241
|
};
|
|
234
242
|
const inserted = sql
|
|
235
243
|
.exec(`INSERT INTO durability_fanout_deliveries
|
|
236
|
-
(id, message_key, target_id, seq, status, phase,
|
|
237
|
-
next_attempt_at, created_at, generation_id)
|
|
238
|
-
VALUES (?, ?, ?, ?, 'pending', 'delivery', 0, ?, ?, ?)
|
|
239
|
-
ON CONFLICT(id) DO NOTHING
|
|
240
|
-
RETURNING id`, row.id, row.message_key, row.target_id, row.seq, row.next_attempt_at, row.created_at, row.generation_id)
|
|
244
|
+
(channel, id, message_key, target_id, seq, status, phase,
|
|
245
|
+
attempt, next_attempt_at, created_at, generation_id)
|
|
246
|
+
VALUES (?, ?, ?, ?, ?, 'pending', 'delivery', 0, ?, ?, ?)
|
|
247
|
+
ON CONFLICT(channel, id) DO NOTHING
|
|
248
|
+
RETURNING id`, __classPrivateFieldGet(this, _DurabilityFanout_channel, "f"), row.id, row.message_key, row.target_id, row.seq, row.next_attempt_at, row.created_at, row.generation_id)
|
|
241
249
|
.toArray().length > 0;
|
|
242
250
|
if (!inserted) {
|
|
243
251
|
throw new Error('Fanout manifest and delivery state disagree');
|
|
@@ -283,7 +291,7 @@ export class DurabilityFanout {
|
|
|
283
291
|
return { success: true, value: entries.map(({ id }) => id), load };
|
|
284
292
|
}
|
|
285
293
|
}
|
|
286
|
-
_DurabilityFanout_engine = new WeakMap(), _DurabilityFanout_routing = new WeakMap(), _DurabilityFanout_targets = new WeakMap(), _DurabilityFanout_policies = new WeakMap(), _DurabilityFanout_dlq = new WeakMap(), _DurabilityFanout_maxBatchSize = new WeakMap(), _DurabilityFanout_batchDelayMs = new WeakMap(), _DurabilityFanout_lifecycle = new WeakMap(), _DurabilityFanout_emit = new WeakMap(), _DurabilityFanout_running = new WeakMap(), _DurabilityFanout_pending = new WeakMap(), _DurabilityFanout_instances = new WeakSet(), _DurabilityFanout_firstAttemptAt = function _DurabilityFanout_firstAttemptAt(createdAt) {
|
|
294
|
+
_DurabilityFanout_engine = new WeakMap(), _DurabilityFanout_channel = new WeakMap(), _DurabilityFanout_table = new WeakMap(), _DurabilityFanout_routing = new WeakMap(), _DurabilityFanout_targets = new WeakMap(), _DurabilityFanout_policies = new WeakMap(), _DurabilityFanout_dlq = new WeakMap(), _DurabilityFanout_maxBatchSize = new WeakMap(), _DurabilityFanout_batchDelayMs = new WeakMap(), _DurabilityFanout_lifecycle = new WeakMap(), _DurabilityFanout_emit = new WeakMap(), _DurabilityFanout_running = new WeakMap(), _DurabilityFanout_pending = new WeakMap(), _DurabilityFanout_instances = new WeakSet(), _DurabilityFanout_firstAttemptAt = function _DurabilityFanout_firstAttemptAt(createdAt) {
|
|
287
295
|
if (__classPrivateFieldGet(this, _DurabilityFanout_batchDelayMs, "f") === 0) {
|
|
288
296
|
return createdAt;
|
|
289
297
|
}
|
|
@@ -294,7 +302,8 @@ _DurabilityFanout_engine = new WeakMap(), _DurabilityFanout_routing = new WeakMa
|
|
|
294
302
|
.array()
|
|
295
303
|
.parse(__classPrivateFieldGet(this, _DurabilityFanout_engine, "f").sql
|
|
296
304
|
.exec(`SELECT DISTINCT target_id FROM durability_fanout_deliveries
|
|
297
|
-
|
|
305
|
+
WHERE channel = ?
|
|
306
|
+
ORDER BY target_id`, __classPrivateFieldGet(this, _DurabilityFanout_channel, "f"))
|
|
298
307
|
.toArray())
|
|
299
308
|
.map((row) => row.target_id);
|
|
300
309
|
// Each target advances independently; a missing or slow target cannot hide
|
|
@@ -329,7 +338,7 @@ _DurabilityFanout_engine = new WeakMap(), _DurabilityFanout_routing = new WeakMa
|
|
|
329
338
|
const exhausted = [];
|
|
330
339
|
const deadline = Date.now() + policy.attemptTimeoutMs;
|
|
331
340
|
for (const row of due) {
|
|
332
|
-
const message = readManifest(sql, row.message_key);
|
|
341
|
+
const message = readManifest(sql, __classPrivateFieldGet(this, _DurabilityFanout_channel, "f"), row.message_key);
|
|
333
342
|
if (!message || message.generation_id !== row.generation_id) {
|
|
334
343
|
throw new Error('Fanout delivery is missing its message manifest');
|
|
335
344
|
}
|
|
@@ -338,7 +347,7 @@ _DurabilityFanout_engine = new WeakMap(), _DurabilityFanout_routing = new WeakMa
|
|
|
338
347
|
exhausted.push({ row, message });
|
|
339
348
|
continue;
|
|
340
349
|
}
|
|
341
|
-
const attempt = claimAttempt(sql,
|
|
350
|
+
const attempt = claimAttempt(sql, __classPrivateFieldGet(this, _DurabilityFanout_table, "f"), row.id, row.generation_id, policy.maxAttempts, deadline);
|
|
342
351
|
if (attempt === undefined) {
|
|
343
352
|
continue;
|
|
344
353
|
}
|
|
@@ -360,7 +369,7 @@ _DurabilityFanout_engine = new WeakMap(), _DurabilityFanout_routing = new WeakMa
|
|
|
360
369
|
}, _DurabilityFanout_postpone = async function _DurabilityFanout_postpone(rows) {
|
|
361
370
|
await __classPrivateFieldGet(this, _DurabilityFanout_instances, "m", _DurabilityFanout_transaction).call(this, (sql) => {
|
|
362
371
|
for (const row of rows) {
|
|
363
|
-
updateAttempt(sql,
|
|
372
|
+
updateAttempt(sql, __classPrivateFieldGet(this, _DurabilityFanout_table, "f"), attemptOf(row), 'next_attempt_at = ?', Date.now() + infrastructureRetryMs);
|
|
364
373
|
}
|
|
365
374
|
});
|
|
366
375
|
}, _DurabilityFanout_deliver = async function _DurabilityFanout_deliver(target, claims, policy) {
|
|
@@ -448,10 +457,9 @@ _DurabilityFanout_engine = new WeakMap(), _DurabilityFanout_routing = new WeakMa
|
|
|
448
457
|
if (!state.finished) {
|
|
449
458
|
continue;
|
|
450
459
|
}
|
|
451
|
-
const current = deliveryRowSchema
|
|
452
|
-
.
|
|
453
|
-
|
|
454
|
-
.exec('SELECT * FROM durability_fanout_deliveries WHERE id = ?', state.claim.row.id)
|
|
460
|
+
const current = deliveryRowSchema.optional().parse(__classPrivateFieldGet(this, _DurabilityFanout_engine, "f").sql
|
|
461
|
+
.exec(`SELECT * FROM durability_fanout_deliveries
|
|
462
|
+
WHERE channel = ? AND id = ?`, __classPrivateFieldGet(this, _DurabilityFanout_channel, "f"), state.claim.row.id)
|
|
455
463
|
.toArray()[0]);
|
|
456
464
|
if (!current ||
|
|
457
465
|
current.generation_id !== state.claim.row.generation_id ||
|
|
@@ -530,7 +538,7 @@ _DurabilityFanout_engine = new WeakMap(), _DurabilityFanout_routing = new WeakMa
|
|
|
530
538
|
body: deserialize(message.payload),
|
|
531
539
|
enqueuedAt: message.created_at,
|
|
532
540
|
attempt: row.attempt,
|
|
533
|
-
memoize: createMemoize(__classPrivateFieldGet(this, _DurabilityFanout_engine, "f").sql,
|
|
541
|
+
memoize: createMemoize(__classPrivateFieldGet(this, _DurabilityFanout_engine, "f").sql, __classPrivateFieldGet(this, _DurabilityFanout_table, "f"), attemptOf(row)),
|
|
534
542
|
ack: traceFunction('DurabilityFanoutMessage.ack', () => settle('ack', async () => {
|
|
535
543
|
await __classPrivateFieldGet(this, _DurabilityFanout_instances, "m", _DurabilityFanout_remove).call(this, row);
|
|
536
544
|
__classPrivateFieldGet(this, _DurabilityFanout_emit, "f").call(this, {
|
|
@@ -560,16 +568,16 @@ _DurabilityFanout_engine = new WeakMap(), _DurabilityFanout_routing = new WeakMa
|
|
|
560
568
|
}
|
|
561
569
|
});
|
|
562
570
|
}, _DurabilityFanout_removeDelivery = function _DurabilityFanout_removeDelivery(sql, row) {
|
|
563
|
-
if (!deleteAttempt(sql,
|
|
571
|
+
if (!deleteAttempt(sql, __classPrivateFieldGet(this, _DurabilityFanout_table, "f"), attemptOf(row))) {
|
|
564
572
|
return false;
|
|
565
573
|
}
|
|
566
|
-
deleteMemos(sql,
|
|
574
|
+
deleteMemos(sql, __classPrivateFieldGet(this, _DurabilityFanout_table, "f"), row.id);
|
|
567
575
|
__classPrivateFieldGet(this, _DurabilityFanout_instances, "m", _DurabilityFanout_adjustPending).call(this, -1);
|
|
568
576
|
sql.exec(`UPDATE durability_fanout_messages
|
|
569
577
|
SET remaining = remaining - 1
|
|
570
|
-
WHERE key = ?`, row.message_key);
|
|
578
|
+
WHERE channel = ? AND key = ?`, __classPrivateFieldGet(this, _DurabilityFanout_channel, "f"), row.message_key);
|
|
571
579
|
sql.exec(`DELETE FROM durability_fanout_messages
|
|
572
|
-
WHERE key = ? AND remaining = 0`, row.message_key);
|
|
580
|
+
WHERE channel = ? AND key = ? AND remaining = 0`, __classPrivateFieldGet(this, _DurabilityFanout_channel, "f"), row.message_key);
|
|
573
581
|
return true;
|
|
574
582
|
}, _DurabilityFanout_retry = async function _DurabilityFanout_retry(claim, policy, override, error, startedAt) {
|
|
575
583
|
const { row } = claim;
|
|
@@ -593,7 +601,7 @@ _DurabilityFanout_engine = new WeakMap(), _DurabilityFanout_routing = new WeakMa
|
|
|
593
601
|
return;
|
|
594
602
|
}
|
|
595
603
|
await __classPrivateFieldGet(this, _DurabilityFanout_instances, "m", _DurabilityFanout_transaction).call(this, (sql) => {
|
|
596
|
-
const updated = updateAttempt(sql,
|
|
604
|
+
const updated = updateAttempt(sql, __classPrivateFieldGet(this, _DurabilityFanout_table, "f"), attemptOf(row), 'next_attempt_at = ?, last_error = ?, last_error_name = ?', nextAttemptAt, error.message, error.name);
|
|
597
605
|
if (!updated) {
|
|
598
606
|
throw new FanoutSettlementError(row.id);
|
|
599
607
|
}
|
|
@@ -625,7 +633,7 @@ _DurabilityFanout_engine = new WeakMap(), _DurabilityFanout_routing = new WeakMa
|
|
|
625
633
|
// Persist intent BEFORE external I/O: eviction or timeout must never turn
|
|
626
634
|
// a terminal decision into another consumer delivery.
|
|
627
635
|
await __classPrivateFieldGet(this, _DurabilityFanout_instances, "m", _DurabilityFanout_transaction).call(this, (sql) => {
|
|
628
|
-
const updated = updateAttempt(sql,
|
|
636
|
+
const updated = updateAttempt(sql, __classPrivateFieldGet(this, _DurabilityFanout_table, "f"), attemptOf(row), `phase = 'dead_letter', dead_lettered_at = ?, dead_letter_reason = ?,
|
|
629
637
|
next_attempt_at = ?, last_error = ?, last_error_name = ?`, timestamp, reason, Date.now() + infrastructureRetryMs, error?.message ?? null, error?.name ?? null);
|
|
630
638
|
if (!updated) {
|
|
631
639
|
throw new FanoutSettlementError(row.id);
|
|
@@ -672,7 +680,7 @@ _DurabilityFanout_engine = new WeakMap(), _DurabilityFanout_routing = new WeakMa
|
|
|
672
680
|
}, _DurabilityFanout_pendingCount = function _DurabilityFanout_pendingCount() {
|
|
673
681
|
__classPrivateFieldSet(this, _DurabilityFanout_pending, __classPrivateFieldGet(this, _DurabilityFanout_pending, "f") ?? countRowSchema.parse(__classPrivateFieldGet(this, _DurabilityFanout_engine, "f").sql
|
|
674
682
|
.exec(`SELECT COUNT(*) AS count FROM durability_fanout_deliveries
|
|
675
|
-
WHERE status = 'pending'
|
|
683
|
+
WHERE channel = ? AND status = 'pending'`, __classPrivateFieldGet(this, _DurabilityFanout_channel, "f"))
|
|
676
684
|
.toArray()[0]).count, "f");
|
|
677
685
|
return __classPrivateFieldGet(this, _DurabilityFanout_pending, "f");
|
|
678
686
|
}, _DurabilityFanout_adjustPending = function _DurabilityFanout_adjustPending(delta) {
|
|
@@ -682,20 +690,20 @@ _DurabilityFanout_engine = new WeakMap(), _DurabilityFanout_routing = new WeakMa
|
|
|
682
690
|
}, _DurabilityFanout_listDue = function _DurabilityFanout_listDue(target, now) {
|
|
683
691
|
const first = deliveryRowSchema.array().parse(__classPrivateFieldGet(this, _DurabilityFanout_engine, "f").sql
|
|
684
692
|
.exec(`SELECT * FROM durability_fanout_deliveries
|
|
685
|
-
WHERE
|
|
686
|
-
AND attempt = 0 AND next_attempt_at <= ?
|
|
693
|
+
WHERE channel = ? AND target_id = ? AND phase = 'delivery'
|
|
694
|
+
AND status = 'pending' AND attempt = 0 AND next_attempt_at <= ?
|
|
687
695
|
ORDER BY seq ASC
|
|
688
|
-
LIMIT ?`, target, now, __classPrivateFieldGet(this, _DurabilityFanout_maxBatchSize, "f"))
|
|
696
|
+
LIMIT ?`, __classPrivateFieldGet(this, _DurabilityFanout_channel, "f"), target, now, __classPrivateFieldGet(this, _DurabilityFanout_maxBatchSize, "f"))
|
|
689
697
|
.toArray());
|
|
690
698
|
if (first.length >= __classPrivateFieldGet(this, _DurabilityFanout_maxBatchSize, "f")) {
|
|
691
699
|
return first;
|
|
692
700
|
}
|
|
693
701
|
const retries = deliveryRowSchema.array().parse(__classPrivateFieldGet(this, _DurabilityFanout_engine, "f").sql
|
|
694
702
|
.exec(`SELECT * FROM durability_fanout_deliveries
|
|
695
|
-
WHERE target_id = ? AND status = 'pending'
|
|
703
|
+
WHERE channel = ? AND target_id = ? AND status = 'pending'
|
|
696
704
|
AND attempt > 0 AND next_attempt_at <= ?
|
|
697
705
|
ORDER BY seq ASC
|
|
698
|
-
LIMIT ?`, target, now, __classPrivateFieldGet(this, _DurabilityFanout_maxBatchSize, "f") - first.length)
|
|
706
|
+
LIMIT ?`, __classPrivateFieldGet(this, _DurabilityFanout_channel, "f"), target, now, __classPrivateFieldGet(this, _DurabilityFanout_maxBatchSize, "f") - first.length)
|
|
699
707
|
.toArray());
|
|
700
708
|
return [...first, ...retries];
|
|
701
709
|
}, _DurabilityFanout_deadline = async function _DurabilityFanout_deadline(run, timeoutMs) {
|