Skip to main content

Class: ScheduledTaskHandler

Constructors

new ScheduledTaskHandler()

new ScheduledTaskHandler(options: ScheduledTaskHandlerOptions): ScheduledTaskHandler

Parameters

ParameterType
optionsScheduledTaskHandlerOptions

Returns

ScheduledTaskHandler

Source

lib/ScheduledTaskHandler.ts:37

Properties

#client

private #client: BullClient

Source

lib/ScheduledTaskHandler.ts:34


#worker

private #worker: Worker<any, any, string>

Source

lib/ScheduledTaskHandler.ts:35


options

readonly options: QueueOptions

The queue options for the scheduled task handler.

Source

lib/ScheduledTaskHandler.ts:27


queue

readonly queue: string

The name of the queue associated with the scheduled task handler.

Source

lib/ScheduledTaskHandler.ts:32

Accessors

client

get client(): BullClient

Returns

BullClient

Source

lib/ScheduledTaskHandler.ts:64


store

get private store(): ScheduledTaskStore

Returns

ScheduledTaskStore

Source

lib/ScheduledTaskHandler.ts:233

Methods

close()

close(): Promise<void>

Closes the internal client and worker.

Returns

Promise<void>

Source

lib/ScheduledTaskHandler.ts:71


create()

create<T>(task: T, options?: number | ScheduledTasksTaskOptions): Promise <ScheduledTasksJob<T>>

Creates a scheduled task.

Type parameters

Type parameter
T extends ScheduledTasksResolvable

Parameters

ParameterTypeDescription
taskTThe task to be scheduled.
options?number | ScheduledTasksTaskOptionsThe options for the task.

Returns

Promise <ScheduledTasksJob<T>>

Source

lib/ScheduledTaskHandler.ts:84


createRepeated()

createRepeated(tasks?: ScheduledTaskCreateRepeatedTask[]): Promise<void>

Creates repeated tasks.

Parameters

ParameterTypeDescription
tasks?ScheduledTaskCreateRepeatedTask[]An optional array of tasks to create. If not provided, it will create tasks based on the stored repeated tasks.

Returns

Promise<void>

Source

lib/ScheduledTaskHandler.ts:124


delete()

delete(id: string): Promise<void>

Deletes a scheduled task by its ID.

Parameters

ParameterTypeDescription
idstringThe ID of the task to delete.

Returns

Promise<void>

Source

lib/ScheduledTaskHandler.ts:156


get()

get<T>(id: T): Promise<undefined | Job<undefined, any, string>>

Retrieves a scheduled task by its ID.

Type parameters

Type parameter
T extends never

Parameters

ParameterTypeDescription
idTThe ID of the scheduled task to retrieve.

Returns

Promise<undefined | Job<undefined, any, string>>

Source

lib/ScheduledTaskHandler.ts:188


list()

list(options: ScheduledTaskListOptions): Promise<Job<unknown, any, string>[]>

Retrieves a list of scheduled tasks based on the provided options.

Parameters

ParameterTypeDescription
optionsScheduledTaskListOptionsThe options for filtering the list of scheduled tasks.

Returns

Promise<Job<unknown, any, string>[]>

Source

lib/ScheduledTaskHandler.ts:166


listRepeated()

listRepeated(options: ScheduledTaskListRepeatedOptions): Promise<RepeatableJob[]>

Retrieves a list of repeated scheduled tasks based on the provided options.

Parameters

ParameterTypeDescription
optionsScheduledTaskListRepeatedOptionsThe options for filtering the list of repeated scheduled tasks.

Returns

Promise<RepeatableJob[]>

Source

lib/ScheduledTaskHandler.ts:177


resolveTask()

private resolveTask(task: ScheduledTasksResolvable): ScheduledTasksResolvablePayload<never>

Parameters

ParameterType
taskScheduledTasksResolvable

Returns

ScheduledTasksResolvablePayload<never>

Source

lib/ScheduledTaskHandler.ts:237


run()

run(task: ScheduledTasksResolvable): Promise<undefined | null | number>

Runs a scheduled task with the given name and payload.

Parameters

ParameterTypeDescription
taskScheduledTasksResolvableThe name of the scheduled task to run.

Returns

Promise<undefined | null | number>

Remarks

undefined will be returned if the task was not found.

Source

lib/ScheduledTaskHandler.ts:202