Skip to content

Commit 1b0b50e

Browse files
committed
Merge branch 'main' into pool-centric
2 parents c665c80 + bb03d1c commit 1b0b50e

File tree

12 files changed

+162
-76
lines changed

12 files changed

+162
-76
lines changed

.well-known/funding-manifest-urls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
https://graphile.org/funding.json
1+
https://www.graphile.org/funding.json

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,7 @@ And please give some love to our featured sponsors 🤩:
3131

3232
<table><tr>
3333
<td align="center"><a href="https://www.the-guild.dev/"><img src="https://graphile.org/images/sponsors/theguild.png" width="90" height="90" alt="The Guild" /><br />The Guild</a> *</td>
34-
<td align="center"><a href="https://dovetailapp.com/"><img src="https://graphile.org/images/sponsors/dovetail.png" width="90" height="90" alt="Dovetail" /><br />Dovetail</a> *</td>
35-
<td align="center"><a href="https://stellate.co/"><img src="https://graphile.org/images/sponsors/Stellate.png" width="90" height="90" alt="Stellate" /><br />Stellate</a> *</td>
3634
<td align="center"><a href="https://gosteelhead.com/"><img src="https://graphile.org/images/sponsors/steelhead.svg" width="90" height="90" alt="Steelhead" /><br />Steelhead</a> *</td>
37-
</tr><tr>
38-
<td align="center"><a href=""><img src="https://graphile.org/images/sponsors/latchbio.jpg" width="90" height="90" alt="LatchBio" /><br />LatchBio</a> *</td>
3935
</tr></table>
4036

4137
<em>\* Sponsors the entire Graphile suite</em>

RELEASE_NOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ Read more:
4444
- `helpers.abortPromise` added; will reject when `abortSignal` aborts (useful
4545
for `Promise.race()`)
4646
- `backfillPeriod` is now marked as optional in TypeScript (defaults to 0).
47+
- Support for loading tasks from nested folders in crontab.
48+
- (`* * * * * nested/folder/task ?jobKey=my_key&jobKeyMode=preserve_run_at`)
4749

4850
## v0.16.6
4951

SPONSORS.md

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,27 @@ Graphile ecosystem. Find out
77
## Featured
88

99
- The Guild
10-
- Dovetail
11-
- Stellate
1210
- Steelhead
13-
- LatchBio
1411

1512
## Leaders
1613

1714
- Robert Claypool
18-
- nigelrmtaylor
1915
- Principia Mentis
16+
- nigelrmtaylor
17+
- Trigger.dev
2018
- Axinom
2119
- Taiste
22-
- Notably
23-
- Trigger.dev
24-
- Cintra
2520
- BairesDev
21+
- Cintra
2622
- Two Bit Solutions
2723
- Dimply
2824
- Ndustrial
25+
- Apollo
2926
- Beacon
3027
- deliver.media
31-
- Spear AI
32-
- Seam
33-
- Apollo
3428
- Ravio
35-
- OpenPipe
36-
- dotcom-monitor
29+
- prodready
30+
- Locomote
3731

3832
## Supporters
3933

@@ -44,25 +38,23 @@ Graphile ecosystem. Find out
4438
- Alvin Ali Khaled
4539
- Paul Melnikow
4640
- Keith Layne
47-
- Zymego
4841
- nullachtvierzehn
49-
- IFCHOR GROUP
50-
- Nate Smith
51-
- Vizcom
52-
- Ether
42+
- Zymego
5343
- garpulon
44+
- Ether
45+
- Nate Smith
5446
- The Outbound Collective
5547
- Charlie Hadden
48+
- Vizcom
5649
- Kiron Open Higher Education
5750
- Andrew Joseph
58-
- SIED 70
51+
- SIED 70 - TE 70
5952
- Peter C. Romano
6053
- mateo
6154
- Dialo
62-
- Gus Becciu
6355
- kontakto-fi
6456
- Tailos, Inc.
6557
- sheilamosaik
66-
- Miguel O. Carvajal
67-
- Jovi De Croock
68-
- Graphite
58+
- Jody Hoon-Starr
59+
- Justin Carrus
60+
- WorkOS

__tests__/__snapshots__/crontab.test.ts.snap

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,5 +143,35 @@ Array [
143143
"task": "with_key_and_mode",
144144
Symbol(isParsed): true,
145145
},
146+
Object {
147+
"identifier": "nested/task",
148+
"match": [Function],
149+
"options": Object {
150+
"backfillPeriod": 0,
151+
"jobKey": "my_key",
152+
"jobKeyMode": "preserve_run_at",
153+
"maxAttempts": undefined,
154+
"priority": undefined,
155+
"queueName": undefined,
156+
},
157+
"payload": null,
158+
"task": "nested/task",
159+
Symbol(isParsed): true,
160+
},
161+
Object {
162+
"identifier": "nested/folder/task",
163+
"match": [Function],
164+
"options": Object {
165+
"backfillPeriod": 0,
166+
"jobKey": "my_key",
167+
"jobKeyMode": "preserve_run_at",
168+
"maxAttempts": undefined,
169+
"priority": undefined,
170+
"queueName": undefined,
171+
},
172+
"payload": null,
173+
"task": "nested/folder/task",
174+
Symbol(isParsed): true,
175+
},
146176
]
147177
`;

__tests__/crontab.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ test("parses crontab file correctly", () => {
4444
* * * * * lots_of_spaces
4545
* * * * * with_key ?jobKey=my_key
4646
* * * * * with_key_and_mode ?jobKey=my_key&jobKeyMode=preserve_run_at
47+
* * * * * nested/task ?jobKey=my_key&jobKeyMode=preserve_run_at
48+
* * * * * nested/folder/task ?jobKey=my_key&jobKeyMode=preserve_run_at
4749
`;
4850
const parsed = parseCrontab(exampleCrontab);
4951

@@ -173,6 +175,20 @@ test("parses crontab file correctly", () => {
173175
});
174176
expect(parsed[8].payload).toEqual(null);
175177

178+
expect(parsed[9].task).toEqual("nested/task");
179+
expect(parsed[9].identifier).toEqual("nested/task");
180+
const parsedCronMatch9 = (parsed[9].match as any)
181+
.parsedCronMatch as ParsedCronMatch;
182+
expect(parsedCronMatch9.minutes).toEqual(ALL_MINUTES);
183+
expect(parsedCronMatch9.hours).toEqual(ALL_HOURS);
184+
185+
expect(parsed[10].task).toEqual("nested/folder/task");
186+
expect(parsed[10].identifier).toEqual("nested/folder/task");
187+
const parsedCronMatch10 = (parsed[10].match as any)
188+
.parsedCronMatch as ParsedCronMatch;
189+
expect(parsedCronMatch10.minutes).toEqual(ALL_MINUTES);
190+
expect(parsedCronMatch10.hours).toEqual(ALL_HOURS);
191+
176192
expect(parsed).toMatchSnapshot();
177193
});
178194

__tests__/schema.sql

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -376,23 +376,23 @@ ALTER TABLE graphile_worker._private_known_crontabs ENABLE ROW LEVEL SECURITY;
376376
ALTER TABLE graphile_worker._private_tasks ENABLE ROW LEVEL SECURITY;
377377
SELECT pg_catalog.set_config('search_path', '', false);
378378
COPY graphile_worker.migrations (id, ts, breaking) FROM stdin;
379-
1 1970-01-01 00:00:00.000000+00 t
380-
2 1970-01-01 00:00:00.000000+00 f
381-
3 1970-01-01 00:00:00.000000+00 t
382-
4 1970-01-01 00:00:00.000000+00 f
383-
5 1970-01-01 00:00:00.000000+00 f
384-
6 1970-01-01 00:00:00.000000+00 f
385-
7 1970-01-01 00:00:00.000000+00 f
386-
8 1970-01-01 00:00:00.000000+00 f
387-
9 1970-01-01 00:00:00.000000+00 f
388-
10 1970-01-01 00:00:00.000000+00 f
389-
11 1970-01-01 00:00:00.000000+00 t
390-
12 1970-01-01 00:00:00.000000+00 f
391-
13 1970-01-01 00:00:00.000000+00 t
392-
14 1970-01-01 00:00:00.000000+00 t
393-
15 1970-01-01 00:00:00.000000+00 f
394-
16 1970-01-01 00:00:00.000000+00 t
395-
17 1970-01-01 00:00:00.000000+00 f
396-
18 1970-01-01 00:00:00.000000+00 f
397-
19 1970-01-01 00:00:00.000000+00 t
379+
1 2025-06-10 12:04:24.070122+01 t
380+
2 2025-06-10 12:04:24.104214+01 f
381+
3 2025-06-10 12:04:24.113671+01 t
382+
4 2025-06-10 12:04:24.116167+01 f
383+
5 2025-06-10 12:04:24.119419+01 f
384+
6 2025-06-10 12:04:24.121693+01 f
385+
7 2025-06-10 12:04:24.137432+01 f
386+
8 2025-06-10 12:04:24.139854+01 f
387+
9 2025-06-10 12:04:24.153728+01 f
388+
10 2025-06-10 12:04:24.155443+01 f
389+
11 2025-06-10 12:04:24.157855+01 t
390+
12 2025-06-10 12:04:24.258834+01 f
391+
13 2025-06-10 12:04:24.261754+01 t
392+
14 2025-06-10 12:04:24.263805+01 t
393+
15 2025-06-10 12:04:24.265574+01 f
394+
16 2025-06-10 12:04:24.267217+01 t
395+
17 2025-06-10 12:04:24.270686+01 f
396+
18 2025-06-10 12:04:24.272704+01 f
397+
19 2025-06-10 12:04:24.274531+01 t
398398
\.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"@types/debug": "^4.1.10",
5656
"@types/pg": "^8.10.5",
5757
"cosmiconfig": "^8.3.6",
58-
"graphile-config": "^0.0.1-beta.14",
58+
"graphile-config": "^0.0.1-beta.16",
5959
"json5": "^2.2.3",
6060
"pg": "^8.11.3",
6161
"tslib": "^2.6.2",
@@ -86,7 +86,7 @@
8686
"eslint-plugin-jest": "^26.0.0",
8787
"eslint-plugin-simple-import-sort": "^10.0.0",
8888
"eslint_d": "^13.0.0",
89-
"graphile": "^5.0.0-beta.16",
89+
"graphile": "^5.0.0-beta.41",
9090
"jest": "^26.0.0",
9191
"jest-time-helpers": "0.1.1",
9292
"juice": "5.2.0",

src/cronConstants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const CRONTAB_WILDCARD = /^\*(?:\/([0-9]+))?$/;
2828
// The command from the crontab line
2929
/** Splits the command from the crontab line into the task, options and payload. */
3030
export const CRONTAB_COMMAND =
31-
/^([_a-zA-Z][_a-zA-Z0-9:_-]*)(?:\s+\?([^\s]+))?(?:\s+(\{.*\}))?$/;
31+
/^([_a-zA-Z][_a-zA-Z0-9:/_-]*)(?:\s+\?([^\s]+))?(?:\s+(\{.*\}))?$/;
3232

3333
// Crontab command options
3434
/** Matches the id=UID option, capturing the unique identifier */

website/docs/library/queue.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,27 @@ singleton throughout your code.
8080
- `schema` can be used to change the default `graphile_worker` schema to
8181
something else (equivalent to `--schema` on the CLI)
8282

83+
:::warning If you use `pgPool`, ensure it has error handlers!
84+
85+
If your `pgPool` doesn't have error handlers then connection issues with the
86+
database may cause your Worker process to exit prematurely.
87+
88+
```ts
89+
import { Pool } from "pg";
90+
const pool = new Pool({
91+
/* ... */
92+
});
93+
94+
/* highlight-start */
95+
// No action necessary
96+
function handleError() {}
97+
pool.on("error", handleError);
98+
pool.on("connect", (client) => void client.on("error", handleError));
99+
/* highlight-end */
100+
```
101+
102+
:::
103+
83104
## `WorkerUtils`
84105

85106
A `WorkerUtils` instance has the following methods:
@@ -95,6 +116,13 @@ A `WorkerUtils` instance has the following methods:
95116

96117
## `addJobAdhoc()`
97118

119+
:::info
120+
121+
This was called `quickAddJob()` in Graphile Worker up until v0.16.x, but was
122+
renamed to `addJobAdHoc()` in v0.17.
123+
124+
:::
125+
98126
```ts
99127
function addJobAdhoc(options: WorkerUtilsOptions, ...addJobArgs): Promise<Job>;
100128
```

0 commit comments

Comments
 (0)