Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 9 additions & 3 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ export interface AddJobsJobSpec<

/**
* The queue to run this task under (only specify if you want jobs in this
* queue to run serially). (Default: null)
* queue to run serially). Avoid using high cardinality values (e.g., random
* strings, UUIDs, timestamps) as this degrades performance and requires
* periodic database cleanup. (Default: null)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feedback is welcome on the phrasing here - I don't feel strongly!

*/
queueName?: string;

Expand Down Expand Up @@ -336,7 +338,9 @@ export interface CronItemOptions {
/** Optionally override the default job max_attempts */
maxAttempts?: number;

/** Optionally set the job queue_name to enforce that the jobs run serially */
/** Optionally set the job queue_name to enforce that the jobs run serially.
* Avoid using high cardinality values (e.g., random strings, UUIDs, timestamps)
* as this degrades performance and requires periodic database cleanup. */
queueName?: string;

/** Optionally set the job priority */
Expand Down Expand Up @@ -586,7 +590,9 @@ export interface Cron {
export interface TaskSpec {
/**
* The queue to run this task under (only specify if you want jobs in this
* queue to run serially). (Default: null)
* queue to run serially). Avoid using high cardinality values (e.g., random
* strings, UUIDs, timestamps) as this degrades performance and requires
* periodic database cleanup. (Default: null)
*/
queueName?: string;

Expand Down
13 changes: 13 additions & 0 deletions website/docs/library/add-job.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,21 @@ The `addJob` arguments are as follows:
- `payload`: an optional JSON-compatible object to give the task more context on
what it is doing, or a list of these objects in &ldquo;batch job&rdquo; mode
- `options`: an optional object specifying:

- `queueName`: if you want certain jobs to run one at a time, add them to the
same named queue (defaults to null which enables parallelization)

:::warning

Avoid using high cardinality values (e.g., random strings, UUIDs,
timestamps) for queue names as this will create many dead queues that
degrade performance and require
[periodic database cleanup](../admin-functions.md#gc_job_queues). If you
find yourself needing to run the `GC_JOB_QUEUES` cleanup task regularly,
you're likely using queue names incorrectly.

:::

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jemgillam Please confirm this renders okay. If not, move it to below the list of options.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine

Screenshot 2025-08-15 at 18 50 47

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lines are all spaced out?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I was only looking at the indentation of the list, not the line spacing between bullets. I have moved the warning outside of the list.

Screenshot 2025-08-15 at 18 57 55

- `runAt`: a `Date` to schedule this task to run in the future
- `maxAttempts`: the maximum number of attempts we'll give the job
(Default: 25)
Expand Down
4 changes: 3 additions & 1 deletion website/docs/library/add-jobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ export interface AddJobsJobSpec {

/**
* The queue to run this task under (only specify if you want jobs in this
* queue to run serially). (Default: null)
* queue to run serially). Avoid using high cardinality values (e.g., random
* strings, UUIDs, timestamps) as this degrades performance and requires
* periodic database cleanup. (Default: null)
*/
queueName?: string;

Expand Down
4 changes: 3 additions & 1 deletion website/docs/sql-add-job.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ this underlying `add_job` SQL function.
what to do, or an array of one or more of these objects for &ldquo;batch
jobs&rdquo; (defaults to an empty object).
- `queue_name` &mdash; if you want certain tasks to run one at a time, add them
to the same named queue (defaults to `null`).
to the same named queue. Avoid using high cardinality values (e.g., random
strings, UUIDs, timestamps) as this degrades performance and requires periodic
database cleanup (defaults to `null`).
- `run_at` &mdash; a timestamp after which to run the job; defaults to now.
- `max_attempts` &mdash; if this task fails, how many times should we retry it?
(defaults to `25`. Must be castable to `smallint`).
Expand Down