class AsyncTaskQueue
A class that represents a queue of asynchronous tasks within a Scheduler.
class AsyncTaskQueue
Notes
- Instances of this class are created using Scheduler.createQueue(), typically accessed from
app.scheduler
. This allows queues to be managed by the scheduler, replacing and stopping them as needed.
Constructor
- constructor(name, options)Creates a new task queue.
Type Members
- class Options staticAn object with options for a particular AsyncTaskQueue.
- type AsyncTaskQueue.Task staticAn object that’s passed as an argument to each task function.
Static Members
- QueueStoppedError staticAn error that’s used to reject the promise returned by AsyncTaskQueue.waitAsync().
- TaskTimeoutError staticAn error that’s thrown when a task has timed out.
Instance Members
- name readonlyThe name of this queue.
- options readonlyThe options that were used to create this queue.
- errors readonlyA list of all errors that were caught while running tasks in this queue.
- countThe number of tasks that are currently in this queue.
- add(f, priority?)Adds a task to be run asynchronously.
- addOrReplace(handle, f, priority?)Adds a task to be run asynchronously, possibly replacing a task currently in the queue.
- isPaused()Returns true if the queue is currently paused.
- pause()Pauses execution of the tasks in this queue.
- resume()Resumes execution of (pending) tasks in this queue.
- stop()Stops this queue, cancelling invocation of pending tasks.
- waitAsync(count?)Waits until the number of pending tasks is equal to or lower than a specified count (or zero).
- run()Invokes pending tasks synchronously.