@workflow/world-postgres 5.0.4 → 5.1.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 +98 -3
- package/dist/config.d.ts +29 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +11 -2
- package/dist/connection-errors.d.ts +23 -0
- package/dist/connection-errors.d.ts.map +1 -0
- package/dist/connection-errors.js +45 -0
- package/dist/drizzle/schema.d.ts +309 -88
- package/dist/drizzle/schema.d.ts.map +1 -1
- package/dist/drizzle/schema.js +106 -30
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +71 -31
- package/dist/job-lease.d.ts +64 -0
- package/dist/job-lease.d.ts.map +1 -0
- package/dist/job-lease.js +317 -0
- package/dist/queue.d.ts +10 -3
- package/dist/queue.d.ts.map +1 -1
- package/dist/queue.js +106 -23
- package/dist/start-hook.d.ts +60 -0
- package/dist/start-hook.d.ts.map +1 -0
- package/dist/start-hook.js +220 -0
- package/dist/storage.d.ts +21 -1
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +729 -467
- package/package.json +7 -7
- package/src/drizzle/migrations/0027_timestamps_with_time_zone.sql +149 -0
- package/src/drizzle/migrations/0028_add_start_hook_admissions.sql +42 -0
- package/src/drizzle/migrations/0029_add_run_job_prefix.sql +4 -0
- package/src/drizzle/migrations/meta/_journal.json +21 -0
package/README.md
CHANGED
|
@@ -131,6 +131,11 @@ export WORKFLOW_POSTGRES_APPLICATION_MANAGED_SHUTDOWN="1"
|
|
|
131
131
|
|
|
132
132
|
# Optional: Maximum Hook minimum retention in days (default: 30)
|
|
133
133
|
export WORKFLOW_POSTGRES_HOOK_RETENTION_LIMIT_DAYS="30"
|
|
134
|
+
|
|
135
|
+
# Optional: Seconds a running delivery's job lock may go unrenewed before
|
|
136
|
+
# another process redelivers the job (default: 0, off; 30 is a good value
|
|
137
|
+
# when more than one process shares the database, see "Crash recovery")
|
|
138
|
+
export WORKFLOW_POSTGRES_JOB_LOCK_STALE_SECONDS="30"
|
|
134
139
|
```
|
|
135
140
|
|
|
136
141
|
### Programmatic usage
|
|
@@ -151,9 +156,17 @@ const world = createWorld({
|
|
|
151
156
|
// Or pass an existing pg.Pool (shared with your app Drizzle, etc.); `world.close()` will not end it.
|
|
152
157
|
import { Pool } from "pg";
|
|
153
158
|
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
|
|
159
|
+
// The World leaves a pool you pass to you: listen for errors, or a connection
|
|
160
|
+
// the server ends (a restart, a failover, an idle timeout) ends the process.
|
|
161
|
+
pool.on("connect", (client) =>
|
|
162
|
+
client.on("error", (error) => console.error(error.message))
|
|
163
|
+
);
|
|
164
|
+
pool.on("error", () => {}); // An idle client's error, logged just above
|
|
154
165
|
const worldFromPool = createWorld({ pool });
|
|
155
166
|
```
|
|
156
167
|
|
|
168
|
+
A connection the server ends emits an `'error'` event, and an `'error'` event with no listener ends the process. When `createWorld()` creates the pool, it listens on the pool and on every client it connects, and logs one `[world-postgres] Pooled PostgreSQL connection lost` line per lost connection. It doesn't add listeners to a pool you pass, so add both yourself, as above: pg-pool listens only on idle clients, and the World holds a checked-out client across a transaction's statements.
|
|
169
|
+
|
|
157
170
|
### Application-managed shutdown
|
|
158
171
|
|
|
159
172
|
By default, Graphile Worker responds automatically when the application is asked to shut down. If your application already coordinates shutdown, set `WORKFLOW_POSTGRES_APPLICATION_MANAGED_SHUTDOWN=1` when selecting the package with `WORKFLOW_TARGET_WORLD`, or set `applicationManagedShutdown: true` when calling `createWorld()` directly. Await `world.close()` from your shutdown path so Graphile Worker cannot terminate the process as soon as its queue stops, before your application finishes closing dependent resources:
|
|
@@ -181,11 +194,12 @@ An aborted HTTP request does not guarantee that its server-side handler stopped,
|
|
|
181
194
|
| ------------------ | --------- | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
|
182
195
|
| `connectionString` | `string` | `process.env.WORKFLOW_POSTGRES_URL`, `process.env.DATABASE_URL`, or `'postgres://world:world@localhost:5432/world'` | Used only when `pool` is omitted, to construct an internal pool |
|
|
183
196
|
| `maxPoolSize` | `number` | `process.env.WORKFLOW_POSTGRES_MAX_POOL_SIZE` or `pg.Pool` default (`10`) | Optional. Sets the internal `pg.Pool` max size when `createWorld()` creates the pool |
|
|
184
|
-
| `pool` | `pg.Pool` | Not applicable | Optional. When set, used for Drizzle, Graphile Worker, and stream writes. `world.close()` does not end it. |
|
|
185
|
-
| `jobPrefix` | `string` | `process.env.WORKFLOW_POSTGRES_JOB_PREFIX`
|
|
197
|
+
| `pool` | `pg.Pool` | Not applicable | Optional. When set, used for Drizzle, Graphile Worker, and stream writes. `world.close()` does not end it, and the World adds no `'error'` listeners to it (see above). |
|
|
198
|
+
| `jobPrefix` | `string` | `process.env.WORKFLOW_POSTGRES_JOB_PREFIX` or `'workflow_'` | Optional prefix for queue job names. Use a distinct prefix per application sharing a database. |
|
|
186
199
|
| `queueConcurrency` | `number` | `50` | Number of concurrent active step executions per process. Must be high enough to cover any parent→child workflow polling in flight because each `Run#returnValue` await holds a worker slot until the child run terminates. |
|
|
187
200
|
| `pollInterval` | `number` | `500` | Milliseconds between idle job fetches per worker. |
|
|
188
201
|
| `applicationManagedShutdown` | `boolean` | `false`; `WORKFLOW_POSTGRES_APPLICATION_MANAGED_SHUTDOWN=1` enables it for the default package configuration | Whether the application coordinates shutdown and awaits `world.close()` instead of Graphile Worker responding automatically. |
|
|
202
|
+
| `jobLockStaleSeconds` | `number` | `process.env.WORKFLOW_POSTGRES_JOB_LOCK_STALE_SECONDS` or `0` (off) | Seconds a running delivery's job lock may go unrenewed before another process redelivers the job. `0` turns renewal and the release of stale locks off. `30` is a good value when more than one process shares the database. See [Crash recovery](#crash-recovery). |
|
|
189
203
|
|
|
190
204
|
## Environment variables
|
|
191
205
|
|
|
@@ -193,12 +207,13 @@ An aborted HTTP request does not guarantee that its server-side handler stopped,
|
|
|
193
207
|
| -------------------------------------- | ------------------------------------------------------------ | ----------------------------------------------- |
|
|
194
208
|
| `WORKFLOW_TARGET_WORLD` | Set to `"@workflow/world-postgres"` to use this world | - |
|
|
195
209
|
| `WORKFLOW_POSTGRES_URL` | PostgreSQL connection string | `DATABASE_URL` or `'postgres://world:world@localhost:5432/world'` |
|
|
196
|
-
| `WORKFLOW_POSTGRES_JOB_PREFIX` | Prefix for queue job names
|
|
210
|
+
| `WORKFLOW_POSTGRES_JOB_PREFIX` | Prefix for queue job names, and the scope of startup recovery | `workflow_` |
|
|
197
211
|
| `WORKFLOW_POSTGRES_WORKER_CONCURRENCY` | Number of concurrent workers | `50` |
|
|
198
212
|
| `WORKFLOW_POSTGRES_POLL_INTERVAL_MS` | Milliseconds between idle job fetches per worker | `500` |
|
|
199
213
|
| `WORKFLOW_POSTGRES_MAX_POOL_SIZE` | Internal `pg.Pool` max size | `10` |
|
|
200
214
|
| `WORKFLOW_POSTGRES_APPLICATION_MANAGED_SHUTDOWN` | Set to `1` when the application coordinates shutdown and awaits `world.close()` | unset (`false`) |
|
|
201
215
|
| `WORKFLOW_POSTGRES_HOOK_RETENTION_LIMIT_DAYS` | Maximum Hook minimum retention in days | `30` |
|
|
216
|
+
| `WORKFLOW_POSTGRES_JOB_LOCK_STALE_SECONDS` | Seconds a running delivery's job lock may go unrenewed before another process redelivers the job; `0` disables | `0` (off) |
|
|
202
217
|
|
|
203
218
|
When `pool` is omitted, `maxPoolSize` precedence is: `createWorld({ maxPoolSize })`, then `WORKFLOW_POSTGRES_MAX_POOL_SIZE`, then the `pg.Pool` default.
|
|
204
219
|
|
|
@@ -255,6 +270,45 @@ import * as schema from '@workflow/world-postgres/schema';
|
|
|
255
270
|
|
|
256
271
|
Make sure your PostgreSQL database is accessible and the user has sufficient permissions to create tables and manage jobs.
|
|
257
272
|
|
|
273
|
+
### Timestamps and time zones
|
|
274
|
+
|
|
275
|
+
Every timestamp column is `timestamp with time zone`, so values are correct
|
|
276
|
+
whatever time zone the server or session runs in. Earlier versions used
|
|
277
|
+
`timestamp without time zone`: on a server outside UTC, `createdAt` came back
|
|
278
|
+
off by the server's UTC offset (for example 7 hours early on
|
|
279
|
+
`America/Los_Angeles`).
|
|
280
|
+
|
|
281
|
+
Migration 0027 converts the columns. On a server in UTC it only changes the
|
|
282
|
+
catalog and rebuilds one small partial index, `workflow_invocations_pending`;
|
|
283
|
+
no table is rewritten. On a server in another time zone it also moves the
|
|
284
|
+
values that came from `now()` (every `created_at`, `updated_at` on rows never
|
|
285
|
+
updated, and `workflow_invocations.responded_at`) from the server's local time
|
|
286
|
+
to the instant they recorded. That costs about one rewrite of each table (new
|
|
287
|
+
row versions, WAL, and bloat until vacuum), with the tables' locks held until
|
|
288
|
+
it finishes, so plan a maintenance window for a large database.
|
|
289
|
+
|
|
290
|
+
The migration waits at most 10 seconds for its locks (unless the session sets
|
|
291
|
+
its own `lock_timeout`), so a long-running transaction makes `bootstrap` fail
|
|
292
|
+
instead of queueing every query behind it. Run `bootstrap` again once that
|
|
293
|
+
transaction ends.
|
|
294
|
+
|
|
295
|
+
It assumes the `now()` values were written in the time zone of the session
|
|
296
|
+
that runs the migration. If your application's pool set a different session
|
|
297
|
+
time zone, set `workflow.legacy_timezone` to that zone for the migration. Use
|
|
298
|
+
`?options=-c%20workflow.legacy_timezone%3DEurope%2FBerlin` in the connection
|
|
299
|
+
string, or, where a pooler drops startup `options` (PgBouncer and several
|
|
300
|
+
hosted poolers), `ALTER DATABASE mydb SET workflow.legacy_timezone =
|
|
301
|
+
'Europe/Berlin'` or `ALTER ROLE myuser SET ...` before running `bootstrap`.
|
|
302
|
+
|
|
303
|
+
On a server in UTC the upgrade order does not matter: the upgraded World reads
|
|
304
|
+
unconverted columns correctly in any Node.js time zone, and older versions read
|
|
305
|
+
converted ones correctly. On a server outside UTC, stop the previous version's
|
|
306
|
+
workers, run the migration, then start the upgraded app. Older versions read
|
|
307
|
+
the converted columns shifted by the server's UTC offset, which can skip or
|
|
308
|
+
stretch step retry backoffs. For the same reason there is no rolling back past
|
|
309
|
+
0027 on such a server: the migration has no down step, and an older version
|
|
310
|
+
would read every converted value shifted.
|
|
311
|
+
|
|
258
312
|
### Data retention
|
|
259
313
|
|
|
260
314
|
Postgres World does not yet perform general workflow-run cleanup. After a
|
|
@@ -277,6 +331,17 @@ and its token can be reused. If the token is never reused, the expired
|
|
|
277
331
|
- Backlog stays in PostgreSQL when all execution slots are busy
|
|
278
332
|
- Retry and sleep-style delays use Graphile `runAt` scheduling
|
|
279
333
|
- Workflow orchestration and queued step execution are both sent through `/.well-known/workflow/v1/flow`
|
|
334
|
+
- With `jobLockStaleSeconds` set, a running delivery renews its job lock, and a job whose process died is redelivered by another process after `jobLockStaleSeconds` (see below)
|
|
335
|
+
|
|
336
|
+
### Crash recovery
|
|
337
|
+
|
|
338
|
+
Graphile Worker on its own keeps a dead worker's job locked for 4 hours. By default (`jobLockStaleSeconds: 0`), a delivery whose process died mid-delivery is therefore recovered only by the next `start()`, which re-enqueues active runs, or after those 4 hours.
|
|
339
|
+
|
|
340
|
+
Set `jobLockStaleSeconds` (or `WORKFLOW_POSTGRES_JOB_LOCK_STALE_SECONDS`) to turn on lock renewal. A running delivery then renews its Graphile job lock every quarter of `jobLockStaleSeconds`, and at least every 10 seconds, and every process that runs workers releases this World's jobs whose locks have gone unrenewed for `jobLockStaleSeconds`. When a process dies mid-delivery, another process redelivers its jobs within about one and a half windows: about 45 seconds at 30. `30` is a good value when more than one process shares the database. The redelivery counts the attempt the dead process used. In invoke mode, the release covers the run's executor queue too.
|
|
341
|
+
|
|
342
|
+
Use the same value on every process that shares the database. Keep it well above the longest a process can go without running its timers (synchronous work that blocks the event loop) or getting a connection from its pool. A delivery whose renewals stall past the window is redelivered while it still runs, and the original delivery is not acknowledged when it finishes. Workflow and step handlers already tolerate that at-least-once delivery.
|
|
343
|
+
|
|
344
|
+
It's off by default because of rolling upgrades. Processes on an earlier version don't renew their locks, so an upgraded process would redeliver any of their deliveries that run longer than the window, and when the earlier-version process finishes such a delivery, its acknowledgement isn't fenced on the lock holder and can delete the redelivered job's row. So turn it on only once every process that shares the database runs a version that includes `jobLockStaleSeconds`, and set the same value on all of them.
|
|
280
345
|
|
|
281
346
|
### Experimental synchronous invocation
|
|
282
347
|
|
|
@@ -418,6 +483,32 @@ The experimental implementation has these remaining limitations:
|
|
|
418
483
|
The database integration tests use the built core runtime. Build core before
|
|
419
484
|
running `pnpm exec vitest run test/invoke.test.ts` from `packages/world-postgres`.
|
|
420
485
|
|
|
486
|
+
## Troubleshooting
|
|
487
|
+
|
|
488
|
+
### A run stays `running` after a crash
|
|
489
|
+
|
|
490
|
+
Earlier versions wrote a step's `step_completed` or `step_failed` event
|
|
491
|
+
separately from the step row. A process that died between the two left the step
|
|
492
|
+
finished with no matching event, and the run never advanced. This query lists
|
|
493
|
+
those steps for runs still `running`:
|
|
494
|
+
|
|
495
|
+
```sql
|
|
496
|
+
select s.run_id, s.step_id, s.step_name, s.status
|
|
497
|
+
from workflow.workflow_steps s
|
|
498
|
+
join workflow.workflow_runs r on r.id = s.run_id
|
|
499
|
+
where r.status = 'running'
|
|
500
|
+
and s.status in ('completed', 'failed')
|
|
501
|
+
and not exists (
|
|
502
|
+
select 1 from workflow.workflow_events e
|
|
503
|
+
where e.run_id = s.run_id
|
|
504
|
+
and e.correlation_id = s.step_id
|
|
505
|
+
and e.type = 'step_' || s.status
|
|
506
|
+
);
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
Upgrading does not recover these runs. Cancel each one with
|
|
510
|
+
`workflow cancel <run-id>`.
|
|
511
|
+
|
|
421
512
|
## Development
|
|
422
513
|
|
|
423
514
|
For local development, you can use the included Docker Compose configuration:
|
|
@@ -456,3 +547,7 @@ To use the PostgreSQL world, set the `WORKFLOW_TARGET_WORLD` environment variabl
|
|
|
456
547
|
```bash
|
|
457
548
|
export WORKFLOW_TARGET_WORLD="@workflow/world-postgres"
|
|
458
549
|
```
|
|
550
|
+
|
|
551
|
+
## Spec 9 (experimental)
|
|
552
|
+
|
|
553
|
+
Runs of the experimental spec 9 runtime (`WORKFLOW_SPEC_VERSION=9`) run their orchestrator deliveries one at a time through the run's Graphile named queue, with or without invocation, and publish their keyed messages with the `unsafe_dedupe` job key mode. A worker killed mid-job leaves that named queue locked, so such a run can stall for up to 4 hours unless `jobLockStaleSeconds` is set. See [world-postgres on spec 9 runs](https://workflow-sdk.dev/docs/changelog/spec-9#first-party-worlds).
|
package/dist/config.d.ts
CHANGED
|
@@ -9,6 +9,14 @@ type PgConnectionConfig = {
|
|
|
9
9
|
maxPoolSize?: undefined;
|
|
10
10
|
};
|
|
11
11
|
export type PostgresWorldConfig = PgConnectionConfig & {
|
|
12
|
+
/**
|
|
13
|
+
* Prefix of the Graphile Worker tasks this World enqueues to and claims
|
|
14
|
+
* from (`${jobPrefix}flows`). Apps sharing a database keep their jobs apart
|
|
15
|
+
* by using distinct prefixes. Each run is stamped with the prefix of the
|
|
16
|
+
* World that created it, and `start()` re-enqueues only the active runs
|
|
17
|
+
* stamped with this World's prefix (plus unstamped runs, created before
|
|
18
|
+
* the stamp existed). Defaults to `workflow_`.
|
|
19
|
+
*/
|
|
12
20
|
jobPrefix?: string;
|
|
13
21
|
/**
|
|
14
22
|
* namespace for queue topic prefixes (e.g. 'custom' → '__custom_wkf_workflow_').
|
|
@@ -20,6 +28,20 @@ export type PostgresWorldConfig = PgConnectionConfig & {
|
|
|
20
28
|
pollInterval?: number;
|
|
21
29
|
/** Enable experimental invoke() delivery with one Graphile execution queue per run. */
|
|
22
30
|
enableInvoke?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Seconds a running delivery's Graphile job lock may go unrenewed before
|
|
33
|
+
* another process releases the job for redelivery. A delivery renews its
|
|
34
|
+
* lock while it runs, so this bounds how long a job whose process died stays
|
|
35
|
+
* locked. Use the same value on every process that shares the database, and
|
|
36
|
+
* keep it well above the longest time a process can go without running its
|
|
37
|
+
* timers (a blocked event loop) or getting a pool connection. `0` turns
|
|
38
|
+
* renewal and the release of stale locks off, which leaves recovery to
|
|
39
|
+
* Graphile Worker's fixed 4 hour reset and to restarts.
|
|
40
|
+
* Defaults to WORKFLOW_POSTGRES_JOB_LOCK_STALE_SECONDS, then `0` (off).
|
|
41
|
+
* 30 is a good value when more than one process shares the database; turn
|
|
42
|
+
* it on once every process runs a version that renews its locks.
|
|
43
|
+
*/
|
|
44
|
+
jobLockStaleSeconds?: number;
|
|
23
45
|
/**
|
|
24
46
|
* Whether the application coordinates shutdown instead of Graphile Worker
|
|
25
47
|
* responding automatically. The application must await world.close().
|
|
@@ -33,5 +55,12 @@ export type PostgresWorldConfig = PgConnectionConfig & {
|
|
|
33
55
|
*/
|
|
34
56
|
streamFlushIntervalMs?: number;
|
|
35
57
|
};
|
|
58
|
+
/**
|
|
59
|
+
* The effective `jobPrefix`: the one the queue builds its Graphile task names
|
|
60
|
+
* from, and the one stamped on the runs this World creates. Both must come
|
|
61
|
+
* from here, so that recovery only ever re-enqueues a run into the task whose
|
|
62
|
+
* runner claims it.
|
|
63
|
+
*/
|
|
64
|
+
export declare function resolveJobPrefix(config: Pick<PostgresWorldConfig, 'jobPrefix'>): string;
|
|
36
65
|
export {};
|
|
37
66
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAE/B,KAAK,kBAAkB,GACnB;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,SAAS,CAAA;CAAE,GACpE;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAAC,WAAW,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC;AAE1E,MAAM,MAAM,mBAAmB,GAAG,kBAAkB,GAAG;IACrD,SAAS,CAAC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C9B,MAAM,EAAE,IAAI,CAAC,mBAAmB,EAAE,WAAW,CAAC,GAC7C,MAAM,CAER"}
|
package/dist/config.js
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const DEFAULT_JOB_PREFIX = 'workflow_';
|
|
2
|
+
/**
|
|
3
|
+
* The effective `jobPrefix`: the one the queue builds its Graphile task names
|
|
4
|
+
* from, and the one stamped on the runs this World creates. Both must come
|
|
5
|
+
* from here, so that recovery only ever re-enqueues a run into the task whose
|
|
6
|
+
* runner claims it.
|
|
7
|
+
*/
|
|
8
|
+
export function resolveJobPrefix(config) {
|
|
9
|
+
return config.jobPrefix || DEFAULT_JOB_PREFIX;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2NvbmZpZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFzREEsTUFBTSxrQkFBa0IsR0FBRyxXQUFXLENBQUM7QUFFdkM7Ozs7O0dBS0c7QUFDSCxNQUFNLFVBQVUsZ0JBQWdCLENBQzlCLE1BQThDO0lBRTlDLE9BQU8sTUFBTSxDQUFDLFNBQVMsSUFBSSxrQkFBa0IsQ0FBQztBQUNoRCxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBQb29sIH0gZnJvbSAncGcnO1xuXG50eXBlIFBnQ29ubmVjdGlvbkNvbmZpZyA9XG4gIHwgeyBjb25uZWN0aW9uU3RyaW5nOiBzdHJpbmc7IG1heFBvb2xTaXplPzogbnVtYmVyOyBwb29sPzogdW5kZWZpbmVkIH1cbiAgfCB7IHBvb2w6IFBvb2w7IGNvbm5lY3Rpb25TdHJpbmc/OiB1bmRlZmluZWQ7IG1heFBvb2xTaXplPzogdW5kZWZpbmVkIH07XG5cbmV4cG9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d29ya2Zsb3dfJztcblxuLyoqXG4gKiBUaGUgZWZmZWN0aXZlIGBqb2JQcmVmaXhgOiB0aGUgb25lIHRoZSBxdWV1ZSBidWlsZHMgaXRzIEdyYXBoaWxlIHRhc2sgbmFtZXNcbiAqIGZyb20sIGFuZCB0aGUgb25lIHN0YW1wZWQgb24gdGhlIHJ1bnMgdGhpcyBXb3JsZCBjcmVhdGVzLiBCb3RoIG11c3QgY29tZVxuICogZnJvbSBoZXJlLCBzbyB0aGF0IHJlY292ZXJ5IG9ubHkgZXZlciByZS1lbnF1ZXVlcyBhIHJ1biBpbnRvIHRoZSB0YXNrIHdob3NlXG4gKiBydW5uZXIgY2xhaW1zIGl0LlxuICovXG5leHBvcnQgZnVuY3Rpb24gcmVzb2x2ZUpvYlByZWZpeChcbiAgY29uZmlnOiBQaWNrPFBvc3RncmVzV29ybGRDb25maWcsICdqb2JQcmVmaXgnPlxuKTogc3RyaW5nIHtcbiAgcmV0dXJuIGNvbmZpZy5qb2JQcmVmaXggfHwgREVGQVVMVF9KT0JfUFJFRklYO1xufVxuIl19
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Pool } from 'pg';
|
|
2
|
+
/**
|
|
3
|
+
* Keep a connection the server drops from ending the process.
|
|
4
|
+
*
|
|
5
|
+
* A restart or failover, `idle_session_timeout`, `pg_terminate_backend`, or a
|
|
6
|
+
* proxy closing idle sockets can end a connection at any time, and `pg`
|
|
7
|
+
* reports it as an `'error'` event on the client. pg-pool forwards an idle
|
|
8
|
+
* client's error to the pool, but detaches its own listener while a client is
|
|
9
|
+
* checked out, and Drizzle transactions and the invocation mailbox hold
|
|
10
|
+
* clients across statements. An `EventEmitter` with no `'error'` listener
|
|
11
|
+
* throws, so either case is an uncaught exception. Graphile Worker attaches
|
|
12
|
+
* listeners like these only while its runner is up, and a World that is only
|
|
13
|
+
* read from never starts one.
|
|
14
|
+
*
|
|
15
|
+
* Logging is all that is left to do: pg-pool discards a failed client when it
|
|
16
|
+
* is released, and a checked-out client's next query rejects, so its caller
|
|
17
|
+
* still sees the error.
|
|
18
|
+
*
|
|
19
|
+
* Only for a pool the World creates. A pool the caller passes in is theirs to
|
|
20
|
+
* listen on.
|
|
21
|
+
*/
|
|
22
|
+
export declare function handleConnectionErrors(pool: Pool, isClosing: () => boolean): void;
|
|
23
|
+
//# sourceMappingURL=connection-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection-errors.d.ts","sourceRoot":"","sources":["../src/connection-errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,IAAI,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,MAAM,OAAO,GACvB,IAAI,CAuBN"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keep a connection the server drops from ending the process.
|
|
3
|
+
*
|
|
4
|
+
* A restart or failover, `idle_session_timeout`, `pg_terminate_backend`, or a
|
|
5
|
+
* proxy closing idle sockets can end a connection at any time, and `pg`
|
|
6
|
+
* reports it as an `'error'` event on the client. pg-pool forwards an idle
|
|
7
|
+
* client's error to the pool, but detaches its own listener while a client is
|
|
8
|
+
* checked out, and Drizzle transactions and the invocation mailbox hold
|
|
9
|
+
* clients across statements. An `EventEmitter` with no `'error'` listener
|
|
10
|
+
* throws, so either case is an uncaught exception. Graphile Worker attaches
|
|
11
|
+
* listeners like these only while its runner is up, and a World that is only
|
|
12
|
+
* read from never starts one.
|
|
13
|
+
*
|
|
14
|
+
* Logging is all that is left to do: pg-pool discards a failed client when it
|
|
15
|
+
* is released, and a checked-out client's next query rejects, so its caller
|
|
16
|
+
* still sees the error.
|
|
17
|
+
*
|
|
18
|
+
* Only for a pool the World creates. A pool the caller passes in is theirs to
|
|
19
|
+
* listen on.
|
|
20
|
+
*/
|
|
21
|
+
export function handleConnectionErrors(pool, isClosing) {
|
|
22
|
+
const log = (error) => {
|
|
23
|
+
// Expected while the World shuts its pool down.
|
|
24
|
+
if (isClosing())
|
|
25
|
+
return;
|
|
26
|
+
// Never the error itself: pg-pool sets `error.client`, whose connection
|
|
27
|
+
// parameters include the password.
|
|
28
|
+
console.warn(`[world-postgres] Pooled PostgreSQL connection lost${error.code ? ` (${error.code})` : ''}: ${error.message}`);
|
|
29
|
+
};
|
|
30
|
+
pool.on('connect', (client) => {
|
|
31
|
+
let lost = false;
|
|
32
|
+
client.on('error', (error) => {
|
|
33
|
+
// A client nobody has ended reports one drop twice: the server's error,
|
|
34
|
+
// then "Connection terminated unexpectedly" as the socket closes.
|
|
35
|
+
if (lost)
|
|
36
|
+
return;
|
|
37
|
+
lost = true;
|
|
38
|
+
log(error);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
// pg-pool re-emits an idle client's error here after the listener above has
|
|
42
|
+
// logged it, so this one only keeps the pool from throwing.
|
|
43
|
+
pool.on('error', () => { });
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29ubmVjdGlvbi1lcnJvcnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY29ubmVjdGlvbi1lcnJvcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUE7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7R0FtQkc7QUFDSCxNQUFNLFVBQVUsc0JBQXNCLENBQ3BDLElBQVUsRUFDVixTQUF3QjtJQUV4QixNQUFNLEdBQUcsR0FBRyxDQUFDLEtBQWdDLEVBQUUsRUFBRTtRQUMvQyxnREFBZ0Q7UUFDaEQsSUFBSSxTQUFTLEVBQUU7WUFBRSxPQUFPO1FBQ3hCLHdFQUF3RTtRQUN4RSxtQ0FBbUM7UUFDbkMsT0FBTyxDQUFDLElBQUksQ0FDVixxREFBcUQsS0FBSyxDQUFDL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