Skip to content

Commit ba0ff05

Browse files
committed
Merge branch 'main' into yarn-berry
2 parents 40d91c0 + 48406a3 commit ba0ff05

52 files changed

Lines changed: 1927 additions & 2088 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
node-version: [20.x]
19+
node-version: [22.x]
2020
postgres-version: [12, 13, 14, 15]
2121

2222
services:
@@ -49,7 +49,7 @@ jobs:
4949

5050
strategy:
5151
matrix:
52-
node-version: [20.x]
52+
node-version: [22.x]
5353

5454
steps:
5555
- uses: actions/checkout@v3
@@ -67,7 +67,7 @@ jobs:
6767

6868
strategy:
6969
matrix:
70-
node-version: [20.x]
70+
node-version: [22.x]
7171
postgres-version: [12]
7272

7373
services:
@@ -100,7 +100,7 @@ jobs:
100100

101101
strategy:
102102
matrix:
103-
node-version: [20.x]
103+
node-version: [22.x]
104104
postgres-version: [12]
105105

106106
services:

.gitignore

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1-
# Dependencies
2-
node_modules/
1+
/.git
2+
/.yarn/*
3+
/dist
4+
/tsconfig.tsbuildinfo
5+
/npm-debug.log*
36

4-
# yarn2+ stuff
5-
.yarn/*
6-
!.yarn/releases
7-
!.yarn/releases/*
8-
!.yarn/plugins
9-
!.yarn/plugins/*
10-
!.yarn/patches
11-
!.yarn/patches/*
7+
!/.yarn/releases
8+
!/.yarn/releases/*
9+
!/.yarn/plugins
10+
!/.yarn/plugins/*
11+
!/.yarn/patches
12+
!/.yarn/patches/*
13+
/yarn-debug.log*
14+
/yarn-error.log*
1215

13-
# Misc
14-
/.git
15-
dist
16-
npm-debug.log*
17-
yarn-debug.log*
18-
yarn-error.log*
19-
.vscode
16+
/.vscode
17+
/node_modules/
2018
/tasks/
2119
/rewired/
2220
_LOCAL/

.yarn/releases/yarn-4.12.0.cjs

Lines changed: 0 additions & 942 deletions
This file was deleted.

.yarn/releases/yarn-4.16.0.cjs

Lines changed: 944 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,19 @@ enableScripts: false
55
npmMinimalAgeGate: "1w"
66
# Unless it's one of ours:
77
npmPreapprovedPackages:
8+
- "jest-time-helpers"
9+
- "graphile"
10+
- "graphile-config"
811
- "@graphile/*"
9-
- graphile
10-
- graphile-config
12+
13+
approvedGitRepositories:
14+
- "https://github.com/yarnpkg/*"
15+
- "ssh://git@github.com/yarnpkg/*"
1116

1217
# ------------------------------------------------------------------------------
1318

1419
compressionLevel: mixed
1520
enableGlobalCache: false
1621
nodeLinker: node-modules
1722

18-
yarnPath: .yarn/releases/yarn-4.12.0.cjs
23+
yarnPath: .yarn/releases/yarn-4.16.0.cjs

RELEASE_NOTES.md

Lines changed: 67 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,35 +19,88 @@ to make sure the system as a whole remains consistent.
1919
Read more:
2020
[Worker Pro Migration](https://worker.graphile.org/docs/pro/migration).
2121

22-
## Pending
23-
24-
- BREAKING: Jobs and queues are now `locked_by` their `WorkerPool`'s id rather
25-
than the `workerId`. Be sure to upgrade
26-
[Worker Pro](https://worker.graphile.org/docs/pro) at the same time if you're
27-
using it!
22+
## v0.18.0
23+
24+
- Since Node 20 is EOL, Node 22 is now the minimum supported version, per our
25+
[requirements documentation](https://worker.graphile.org/docs/requirements).
26+
- `Runner` gains `[Symbol.asyncDispose]()` method, so you can
27+
`await using runner = await run(...)` and the worker will be released when you
28+
reach the end of the scope. (Primarily useful for tests.)
29+
- Maintenance work: upgrade to latest TypeScript, Jest, eliminate ts-node, fix
30+
yargs, use erasable syntax only for type-stripping support,
31+
32+
## v0.17.2
33+
34+
Implement `npm pkg fix` hint; also: fix `version` export - was _still_
35+
incorrectly reporting 0.17.0-rc.0, because `npm publish` doesn't call `prepack`
36+
when `ignore-scripts` is `true`.
37+
38+
## v0.17.1
39+
40+
Fix `version` export - was incorrectly reporting 0.17.0-rc.0.
41+
42+
## v0.17.0
43+
44+
Major performance enhancements in this release, but they're opt-in!
45+
46+
- BREAKING: jobs and queues are now `locked_by` their `WorkerPool`'s id rather
47+
than the `workerId`.
48+
- BREAKING: Worker Pro users need to update to `@graphile-pro/worker@0.2.x` at
49+
the same time as updating Graphile Worker to this release (due to the above
50+
breaking change).
51+
- BREAKING: We'll now warn you if you haven't installed error handlers on the
52+
pool, and will only install them ourself if needed.
53+
- BREAKING: Fixes bug where CLI defaults override `graphile.config.js` settings
54+
(by removing CLI defaults).
55+
- New **batching of job completion** can be enabled by setting
56+
`preset.worker.completeJobBatchDelay` and `preset.worker.failJobBatchDelay` to
57+
a number `0` or higher. This can significantly reduce load on the database, at
58+
the cost of potentially leaving more locked jobs if worker crashes or is
59+
killed without cleanup before the batch executes.
60+
- New **local queue** can be enabled by setting `preset.worker.localQueue.size`
61+
to `1` or higher (recommend setting it to `concurrency + 1`). This allows jobs
62+
to be fetched in a batch and distributed locally rather on-demand fetching
63+
from each worker in the local pool; this significantly reduces load on the
64+
database especially if you're running with high concurrency. The trade-off is
65+
that more jobs will be locked at a time, and when local queues are full higher
66+
priority tasks added to the database won't be "seen" until the local queue is
67+
refetched.
2868
- New `addJobs()` JS method to enable efficiently adding a batch of jobs via the
29-
JS API
69+
JS API.
70+
- Prepared statements can now be disabled via
71+
`preset.worker.preparedStatements = false`, useful when connecting to the
72+
database in a way that does not reliably support them. There's a minor
73+
performance penalty, so only turn them off if you need to.
74+
- New `middleware` system enabled by `graphile-config` is now preferred over
75+
hooks (which will be deprecated and removed in later versions). Middleware
76+
better enable activities to be wrapped, e.g. `bootstrap` middleware can take
77+
actions both before and after bootstrapping and share variables between them,
78+
rather than the old `prebootstrap`/`postbootstrap` hooks which need more
79+
complex integration.
80+
- Fixed issue with cron where enough errors (for example due to database
81+
downtime) would cause it to stop trying, leaving a seemingly healthy worker
82+
that wasn't executing cron. Cron will now retry startup indefinitely (with
83+
exponential backoff) _and_ will perform the relevant backfills when the
84+
connection is re-established.
3085
- DEPRECATION: `quickAddJob` has been renamed to `addJobAdhoc` to make it
3186
clearer that it's for use in one-off locations (some felt the "quick" referred
3287
to the speed it executed, rather than the amount of effort required from the
33-
programmer)
34-
- We'll now warn you if you haven't installed error handlers on the pool, and
35-
will only install them ourself if needed
36-
- Fixes bug where CLI defaults override `graphile.config.js` settings (by
37-
removing CLI defaults)
88+
programmer).
3889
- Fix bug where executable tasks had their stdout/stderr ignored; this is now
3990
output via logging (thanks @wineTGH).
4091
- Fix race condition when multiple workers attempt to initialise the database at
41-
the same time
92+
the same time.
4293
- `helpers.abortSignal` is no longer typed as `| undefined`. It is still
4394
experimental!
4495
- `helpers.abortPromise` added; will reject when `abortSignal` aborts (useful
45-
for `Promise.race()`)
96+
for `Promise.race()`).
4697
- `backfillPeriod` is now marked as optional in TypeScript (defaults to 0).
4798
- Support for loading tasks from nested folders in crontab.
4899
- (`* * * * * nested/folder/task ?jobKey=my_key&jobKeyMode=preserve_run_at`)
49100
- Most of our event emitters now trap errors and output a log if such error were
50101
to occur - useful for debugging.
102+
- Worker event payloads now include `ctx`, making plugin/event integrations more
103+
consistent.
51104

52105
## v0.16.6
53106

__tests__/__snapshots__/crontab.test.ts.snap

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`parses crontab file correctly 1`] = `
4-
Array [
5-
Object {
4+
[
5+
{
66
"identifier": "simple",
77
"match": [Function],
8-
"options": Object {
8+
"options": {
99
"backfillPeriod": 0,
1010
"jobKey": undefined,
1111
"jobKeyMode": undefined,
@@ -17,10 +17,10 @@ Array [
1717
"task": "simple",
1818
Symbol(isParsed): true,
1919
},
20-
Object {
20+
{
2121
"identifier": "every_day_at_4_am",
2222
"match": [Function],
23-
"options": Object {
23+
"options": {
2424
"backfillPeriod": 0,
2525
"jobKey": undefined,
2626
"jobKeyMode": undefined,
@@ -32,10 +32,10 @@ Array [
3232
"task": "every_day_at_4_am",
3333
Symbol(isParsed): true,
3434
},
35-
Object {
35+
{
3636
"identifier": "every_sunday_at_4_am",
3737
"match": [Function],
38-
"options": Object {
38+
"options": {
3939
"backfillPeriod": 0,
4040
"jobKey": undefined,
4141
"jobKeyMode": undefined,
@@ -47,10 +47,10 @@ Array [
4747
"task": "every_sunday_at_4_am",
4848
Symbol(isParsed): true,
4949
},
50-
Object {
50+
{
5151
"identifier": "sunday_7",
5252
"match": [Function],
53-
"options": Object {
53+
"options": {
5454
"backfillPeriod": 0,
5555
"jobKey": undefined,
5656
"jobKeyMode": undefined,
@@ -62,46 +62,46 @@ Array [
6262
"task": "every_sunday_at_4_am",
6363
Symbol(isParsed): true,
6464
},
65-
Object {
65+
{
6666
"identifier": "every_tuesday_at_4_am",
6767
"match": [Function],
68-
"options": Object {
68+
"options": {
6969
"backfillPeriod": 0,
7070
"jobKey": undefined,
7171
"jobKeyMode": undefined,
7272
"maxAttempts": undefined,
7373
"priority": undefined,
7474
"queueName": undefined,
7575
},
76-
"payload": Object {
76+
"payload": {
7777
"isTuesday": true,
7878
},
7979
"task": "every_tuesday_at_4_am",
8080
Symbol(isParsed): true,
8181
},
82-
Object {
82+
{
8383
"identifier": "stuff",
8484
"match": [Function],
85-
"options": Object {
85+
"options": {
8686
"backfillPeriod": 2685660000,
8787
"jobKey": undefined,
8888
"jobKeyMode": undefined,
8989
"maxAttempts": 3,
9090
"priority": 3,
9191
"queueName": "my_queue",
9292
},
93-
"payload": Object {
94-
"myExtraPayload": Object {
93+
"payload": {
94+
"myExtraPayload": {
9595
"stuff": "here with # hash char",
9696
},
9797
},
9898
"task": "one",
9999
Symbol(isParsed): true,
100100
},
101-
Object {
101+
{
102102
"identifier": "lots_of_spaces",
103103
"match": [Function],
104-
"options": Object {
104+
"options": {
105105
"backfillPeriod": 0,
106106
"jobKey": undefined,
107107
"jobKeyMode": undefined,
@@ -113,10 +113,10 @@ Array [
113113
"task": "lots_of_spaces",
114114
Symbol(isParsed): true,
115115
},
116-
Object {
116+
{
117117
"identifier": "with_key",
118118
"match": [Function],
119-
"options": Object {
119+
"options": {
120120
"backfillPeriod": 0,
121121
"jobKey": "my_key",
122122
"jobKeyMode": "replace",
@@ -128,10 +128,10 @@ Array [
128128
"task": "with_key",
129129
Symbol(isParsed): true,
130130
},
131-
Object {
131+
{
132132
"identifier": "with_key_and_mode",
133133
"match": [Function],
134-
"options": Object {
134+
"options": {
135135
"backfillPeriod": 0,
136136
"jobKey": "my_key",
137137
"jobKeyMode": "preserve_run_at",
@@ -143,10 +143,10 @@ Array [
143143
"task": "with_key_and_mode",
144144
Symbol(isParsed): true,
145145
},
146-
Object {
146+
{
147147
"identifier": "nested/task",
148148
"match": [Function],
149-
"options": Object {
149+
"options": {
150150
"backfillPeriod": 0,
151151
"jobKey": "my_key",
152152
"jobKeyMode": "preserve_run_at",
@@ -158,10 +158,10 @@ Array [
158158
"task": "nested/task",
159159
Symbol(isParsed): true,
160160
},
161-
Object {
161+
{
162162
"identifier": "nested/folder/task",
163163
"match": [Function],
164-
"options": Object {
164+
"options": {
165165
"backfillPeriod": 0,
166166
"jobKey": "my_key",
167167
"jobKeyMode": "preserve_run_at",

0 commit comments

Comments
 (0)