Class: ScheduledTaskHandler
Constructors
new ScheduledTaskHandler()
new ScheduledTaskHandler(
options
:ScheduledTaskHandlerOptions
):ScheduledTaskHandler
Parameters
Parameter | Type |
---|---|
options | ScheduledTaskHandlerOptions |
Returns
Defined in
lib/ScheduledTaskHandler.ts:37
Properties
#client
private
#client:BullClient
Defined in
lib/ScheduledTaskHandler.ts:34
#worker
private
#worker:Worker
<any
,any
,string
>
Defined in
lib/ScheduledTaskHandler.ts:35
options
readonly
options:QueueOptions
The queue options for the scheduled task handler.
Defined in
lib/ScheduledTaskHandler.ts:27
queue
readonly
queue:string
The name of the queue associated with the scheduled task handler.
Defined in
lib/ScheduledTaskHandler.ts:32
Accessors
client
Get Signature
get client():
BullClient
Returns
Defined in
lib/ScheduledTaskHandler.ts:64
store
Get Signature
get
private
store():ScheduledTaskStore
Returns
Defined in
lib/ScheduledTaskHandler.ts:233
Methods
close()
close():
Promise
<void
>
Closes the internal client and worker.
Returns
Promise
<void
>
Defined in
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
Parameter | Type | Description |
---|---|---|
task | T | The task to be scheduled. |
options ? | number | ScheduledTasksTaskOptions | The options for the task. |
Returns
Defined in
lib/ScheduledTaskHandler.ts:84
createRepeated()
createRepeated(
tasks
?:ScheduledTaskCreateRepeatedTask
[]):Promise
<void
>
Creates repeated tasks.
Parameters
Parameter | Type | Description |
---|---|---|
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
>
Defined in
lib/ScheduledTaskHandler.ts:124
delete()
delete(
id
:string
):Promise
<void
>
Deletes a scheduled task by its ID.
Parameters
Parameter | Type | Description |
---|---|---|
id | string | The ID of the task to delete. |
Returns
Promise
<void
>
Defined in
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
Parameter | Type | Description |
---|---|---|
id | T | The ID of the scheduled task to retrieve. |
Returns
Promise
<undefined
| Job
<undefined
, any
, string
>>
Defined in
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
Parameter | Type | Description |
---|---|---|
options | ScheduledTaskListOptions | The options for filtering the list of scheduled tasks. |
Returns
Promise
<Job
<unknown
, any
, string
>[]>
Defined in
lib/ScheduledTaskHandler.ts:166
listRepeated()
listRepeated(
options
:ScheduledTaskListRepeatedOptions
):Promise
<RepeatableJob
[]>
Retrieves a list of repeated scheduled tasks based on the provided options.
Parameters
Parameter | Type | Description |
---|---|---|
options | ScheduledTaskListRepeatedOptions | The options for filtering the list of repeated scheduled tasks. |
Returns
Promise
<RepeatableJob
[]>
Defined in
lib/ScheduledTaskHandler.ts:177
resolveTask()
private
resolveTask(task
:ScheduledTasksResolvable
):ScheduledTasksResolvablePayload
<never
>
Parameters
Parameter | Type |
---|---|
task | ScheduledTasksResolvable |
Returns
ScheduledTasksResolvablePayload
<never
>
Defined in
lib/ScheduledTaskHandler.ts:237
run()
run(
task
:ScheduledTasksResolvable
):Promise
<undefined
|null
|number
>
Runs a scheduled task with the given name and payload.
Parameters
Parameter | Type | Description |
---|---|---|
task | ScheduledTasksResolvable | The name of the scheduled task to run. |
Returns
Promise
<undefined
| null
| number
>
Remarks
undefined
will be returned if the task was not found.