Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ The format follows semantic versioning principles.

### Fixed

- `ark queue:work --queue` rejected every value in 0.19.5 ("argument '…' is invalid. Allowed choices are …"): musket reads a trailing `: a, b, c` in an option's description as its allowed choices, and the new `--queue` description had one. The description no longer does, and a test pins that `queue:work` options declare no choices.
- `DotPath` (the key type behind `config()` and `configure()`) is now depth-bounded and stops at built-in object types, so configs holding deep or self-referencing library types (nodemailer transports) no longer fail to typecheck with "circularly references itself". The `@ts-expect-error` workarounds in the H3 template and the notifications config are gone.
- `build:templates` builds the templates one at a time; run in parallel, each template's prebuild rebuilt the shared packages concurrently and the builds clobbered each other.
- Fixed type errors in `@arkstack/auth` (`AuthenticationException` request typing and two tests) and in `@arkstack/common`'s `renderError`, which used the `view()` global without a type for it.
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/jobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ With the default `sync` connection the job runs immediately. Configure a `databa
ark queue:work
```

A bare `ark queue:work` processes only the connection's default queue. If jobs go to other queues (`onQueue(...)` or a `queue` property), name them, e.g. `ark queue:work --queue=emails,default`, or use `ark queue:work --queue=*` to work them all.
A bare `ark queue:work` processes only the connection's default queue. If jobs go to other queues (`onQueue(...)` or a `queue` property), name them, e.g. `ark queue:work --queue=emails,default`, or use `ark queue:work '--queue=*'` to work them all (quote the `*` so the shell doesn't expand it).

## Retries & failure handling

Expand Down
5 changes: 3 additions & 2 deletions docs/guide/queue.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ A worker pulls jobs from a connection and runs them. Run one from the CLI:
ark queue:work # daemon on the default connection's default queue
ark queue:work redis --queue=emails
ark queue:work --queue=high,default # priority list: high first, then default
ark queue:work --queue=* # every queue on the connection
ark queue:work '--queue=*' # every queue on the connection (quote the *)
ark queue:work --once # process a single job and exit
ark queue:clear redis --queue=emails
```
Expand All @@ -106,7 +106,8 @@ ark queue:clear redis --queue=emails
- **`*`** works every queue on the connection. The `database` driver takes the
oldest due job across all queues; the `redis` driver discovers queues with
`SCAN` and works them round-robin. Combine it with names to prioritize some:
`--queue=webhook,*`.
`--queue=webhook,*`. Quote any `*` in a shell (`'--queue=webhook,*'`), or
zsh/bash may expand it as a glob.

Every queue that receives jobs needs a worker that lists it (or `*`), or its jobs
wait forever.
Expand Down
5 changes: 3 additions & 2 deletions packages/queue/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ await Queue.clear('emails')
ark queue:work # daemon on the default connection's default queue
ark queue:work redis --queue=emails
ark queue:work --queue=high,default # priority list: high first, then default
ark queue:work --queue=* # every queue on the connection
ark queue:work '--queue=*' # every queue on the connection (quote the *)
ark queue:work --once # process a single job and exit
ark queue:clear redis --queue=emails
```
Expand All @@ -67,7 +67,8 @@ ark queue:clear redis --queue=emails
- **`*`** works every queue on the connection. The `database` driver takes the
oldest due job across all queues; the `redis` driver discovers queues with
`SCAN` and works them round-robin. Combine it with names to prioritize some:
`--queue=webhook,*`.
`--queue=webhook,*`. Quote any `*` in a shell (`'--queue=webhook,*'`), or
zsh/bash may expand it as a glob.

Every queue that receives jobs needs a worker that lists it (or `*`), or its jobs
wait forever.
Expand Down
2 changes: 1 addition & 1 deletion packages/queue/src/commands/QueueWorkCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const reason = (error: unknown): string => (error instanceof Error ? error.messa
export class QueueWorkCommand extends Command {
protected signature = `queue:work
{connection? : The queue connection to work. Defaults to the configured default.}
{--queue= : The queue(s) to process: a name, a comma-separated priority list, or * for every queue.}
{--queue= : The queue(s) to process. One name, a comma-separated priority list, or * for every queue.}
{--sleep=3 : Seconds to sleep when no job is available.}
{--max-jobs=0 : Stop after processing this many jobs (0 for unlimited).}
{--once : Process a single job and exit.}
Expand Down
35 changes: 35 additions & 0 deletions packages/queue/tests/queue-work-command.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { describe, expect, it } from 'vitest'

import { QueueWorkCommand } from '../src/commands/QueueWorkCommand'
import { Signature } from '@h3ravel/musket'

/**
* musket reads `[a, b]` or a trailing `: a, b` in an option's description as its
* allowed choices and rejects any other value. A description that tripped this
* made `--queue` refuse every queue name, so pin that the worker's options stay
* free-form.
*/
describe('queue:work signature', () => {
const options = () => {
const signature = (
new QueueWorkCommand(undefined as never, undefined as never) as unknown as {
signature: string
}
).signature

return Signature.parseOptions(signature) as Array<{ name: string; flags?: string[]; choices: string[] }>
}

it('accepts any --queue value (no choices list)', () => {
const queue = options().find((option) => option.flags?.includes('--queue'))

expect(queue).toBeDefined()
expect(queue?.choices).toEqual([])
})

it('declares no choices on any option', () => {
for (const option of options()) {
expect(option.choices, option.name).toEqual([])
}
})
})
Loading