Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie committed Apr 2, 2024
1 parent cc65860 commit e306c4c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion website/docs/worker-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ runner.events.on("job:success", ({ worker, job }) => {
### Example: using `EventEmitter`

```js
/** @type {import("graphile-worker").WorkerEvents} */
const events = new EventEmitter();
events.on(...);
events.on(...);
Expand All @@ -31,17 +32,21 @@ const runner = await run({ events, ... });
### Example: In graphile configuration

```js
/** @type {import("graphile-worker").WorkerEvents} */
const events = new EventEmitter();
events.on(...);
events.on(...);
events.on(...);

/** @type {GraphileConfig.Preset} */
const preset = {
worker: {
events,
...
}
};

export default preset;
```

## Definitions:
Expand Down Expand Up @@ -122,7 +127,8 @@ export type WorkerEvents = TypedEventEmitter<{
"worker:getJob:empty": { worker: Worker };

/**
* When a worker is created
* When a worker faces a fatal error, for example it was unable to inform the
* database that it had completed/failed a job.
*/
"worker:fatalError": { worker: Worker; error: any; jobError: any | null };

Expand Down

0 comments on commit e306c4c

Please sign in to comment.