import type { BunMariaDBConfig, DBResponseObject } from "../../types";
type Params
= {
table: Table;
/** Max jobs to claim. Defaults to 1 */
limit?: number;
/** How long the claim lasts before another worker may take the job. Defaults to the table's `lease_ms` */
lease_ms?: number;
/** Jobs whose lease expired after this many attempts are marked `failed`. Defaults to the table's `max_attempts` */
max_attempts?: number;
config?: BunMariaDBConfig;
};
/**
* Claim the next available jobs, oldest `queue_available_at` first. Each
* returned row carries a `queue_lock_token` that must be passed to `ack`,
* `fail` or `extend`.
*
* `FOR UPDATE SKIP LOCKED` lets concurrent workers claim different jobs
* without blocking on each other or claiming the same job twice.
*/
export default function QueueClaim({ table, limit, lease_ms, max_attempts, config, }: Params