pg-boss 10.3.3 → 11.0.1
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 +3 -3
- package/docker-compose.yaml +1 -1
- package/package.json +3 -3
- package/src/attorney.js +69 -220
- package/src/boss.js +100 -117
- package/src/db.js +3 -0
- package/src/index.js +6 -12
- package/src/manager.js +225 -191
- package/src/migrationStore.js +0 -88
- package/src/plans.js +469 -446
- package/src/timekeeper.js +46 -40
- package/src/tools.js +19 -2
- package/types.d.ts +78 -137
- package/version.json +1 -1
package/src/migrationStore.js
CHANGED
|
@@ -64,93 +64,5 @@ function migrate (value, version, migrations) {
|
|
|
64
64
|
|
|
65
65
|
function getAll (schema) {
|
|
66
66
|
return [
|
|
67
|
-
{
|
|
68
|
-
release: '10.1.5',
|
|
69
|
-
version: 24,
|
|
70
|
-
previous: 23,
|
|
71
|
-
install: [
|
|
72
|
-
`
|
|
73
|
-
CREATE OR REPLACE FUNCTION ${schema}.create_queue(queue_name text, options json)
|
|
74
|
-
RETURNS VOID AS
|
|
75
|
-
$$
|
|
76
|
-
DECLARE
|
|
77
|
-
table_name varchar := 'j' || encode(sha224(queue_name::bytea), 'hex');
|
|
78
|
-
queue_created_on timestamptz;
|
|
79
|
-
BEGIN
|
|
80
|
-
|
|
81
|
-
WITH q as (
|
|
82
|
-
INSERT INTO ${schema}.queue (
|
|
83
|
-
name,
|
|
84
|
-
policy,
|
|
85
|
-
retry_limit,
|
|
86
|
-
retry_delay,
|
|
87
|
-
retry_backoff,
|
|
88
|
-
expire_seconds,
|
|
89
|
-
retention_minutes,
|
|
90
|
-
dead_letter,
|
|
91
|
-
partition_name
|
|
92
|
-
)
|
|
93
|
-
VALUES (
|
|
94
|
-
queue_name,
|
|
95
|
-
options->>'policy',
|
|
96
|
-
(options->>'retryLimit')::int,
|
|
97
|
-
(options->>'retryDelay')::int,
|
|
98
|
-
(options->>'retryBackoff')::bool,
|
|
99
|
-
(options->>'expireInSeconds')::int,
|
|
100
|
-
(options->>'retentionMinutes')::int,
|
|
101
|
-
options->>'deadLetter',
|
|
102
|
-
table_name
|
|
103
|
-
)
|
|
104
|
-
ON CONFLICT DO NOTHING
|
|
105
|
-
RETURNING created_on
|
|
106
|
-
)
|
|
107
|
-
SELECT created_on into queue_created_on from q;
|
|
108
|
-
|
|
109
|
-
IF queue_created_on IS NULL THEN
|
|
110
|
-
RETURN;
|
|
111
|
-
END IF;
|
|
112
|
-
|
|
113
|
-
EXECUTE format('CREATE TABLE ${schema}.%I (LIKE ${schema}.job INCLUDING DEFAULTS)', table_name);
|
|
114
|
-
|
|
115
|
-
EXECUTE format('ALTER TABLE ${schema}.%1$I ADD PRIMARY KEY (name, id)', table_name);
|
|
116
|
-
EXECUTE format('ALTER TABLE ${schema}.%1$I ADD CONSTRAINT q_fkey FOREIGN KEY (name) REFERENCES ${schema}.queue (name) ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED', table_name);
|
|
117
|
-
EXECUTE format('ALTER TABLE ${schema}.%1$I ADD CONSTRAINT dlq_fkey FOREIGN KEY (dead_letter) REFERENCES ${schema}.queue (name) ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED', table_name);
|
|
118
|
-
EXECUTE format('CREATE UNIQUE INDEX %1$s_i1 ON ${schema}.%1$I (name, COALESCE(singleton_key, '''')) WHERE state = ''created'' AND policy = ''short''', table_name);
|
|
119
|
-
EXECUTE format('CREATE UNIQUE INDEX %1$s_i2 ON ${schema}.%1$I (name, COALESCE(singleton_key, '''')) WHERE state = ''active'' AND policy = ''singleton''', table_name);
|
|
120
|
-
EXECUTE format('CREATE UNIQUE INDEX %1$s_i3 ON ${schema}.%1$I (name, state, COALESCE(singleton_key, '''')) WHERE state <= ''active'' AND policy = ''stately''', table_name);
|
|
121
|
-
EXECUTE format('CREATE UNIQUE INDEX %1$s_i4 ON ${schema}.%1$I (name, singleton_on, COALESCE(singleton_key, '''')) WHERE state <> ''cancelled'' AND singleton_on IS NOT NULL', table_name);
|
|
122
|
-
EXECUTE format('CREATE INDEX %1$s_i5 ON ${schema}.%1$I (name, start_after) INCLUDE (priority, created_on, id) WHERE state < ''active''', table_name);
|
|
123
|
-
|
|
124
|
-
EXECUTE format('ALTER TABLE ${schema}.%I ADD CONSTRAINT cjc CHECK (name=%L)', table_name, queue_name);
|
|
125
|
-
EXECUTE format('ALTER TABLE ${schema}.job ATTACH PARTITION ${schema}.%I FOR VALUES IN (%L)', table_name, queue_name);
|
|
126
|
-
END;
|
|
127
|
-
$$
|
|
128
|
-
LANGUAGE plpgsql
|
|
129
|
-
`
|
|
130
|
-
],
|
|
131
|
-
uninstall: []
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
release: '10.1.1',
|
|
135
|
-
version: 23,
|
|
136
|
-
previous: 22,
|
|
137
|
-
install: [
|
|
138
|
-
`ALTER TABLE ${schema}.job ADD PRIMARY KEY (name, id)`
|
|
139
|
-
],
|
|
140
|
-
uninstall: [
|
|
141
|
-
`ALTER TABLE ${schema}.job DROP CONSTRAINT job_pkey`
|
|
142
|
-
]
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
release: '10.0.6',
|
|
146
|
-
version: 22,
|
|
147
|
-
previous: 21,
|
|
148
|
-
install: [
|
|
149
|
-
`ALTER TABLE ${schema}.job ALTER COLUMN retry_limit SET DEFAULT 2`
|
|
150
|
-
],
|
|
151
|
-
uninstall: [
|
|
152
|
-
`ALTER TABLE ${schema}.job ALTER COLUMN retry_limit SET DEFAULT 0`
|
|
153
|
-
]
|
|
154
|
-
}
|
|
155
67
|
]
|
|
156
68
|
}
|