Skip to main content

Queue

@discordeno/botDocs


Documentation / @discordeno/bot / Queue

Class: Queue

Constructors

new Queue()

new Queue(rest, options): Queue

Parameters

rest: RestManager

options: QueueOptions

Returns

Queue

Defined in

packages/rest/dist/types/queue.d.ts:38

Properties

deleteQueueDelay

deleteQueueDelay: number

The time in milliseconds to wait before deleting this queue if it is empty. Defaults to 60000(one minute).

Defined in

packages/rest/dist/types/queue.d.ts:28


deleteQueueTimeout?

optional deleteQueueTimeout: Timeout

The timeout for the deletion of this queue

Defined in

packages/rest/dist/types/queue.d.ts:30


firstRequest

firstRequest: boolean

Whether the first request is pending.

Defined in

packages/rest/dist/types/queue.d.ts:22


frozenAt

frozenAt: number

When requests started being made to determine when the interval will reset it.

Defined in

packages/rest/dist/types/queue.d.ts:26


identifier

identifier: string

The identifier for this request, may be the request authorization or fallback to the bot auth

Remarks

This is used to get the identify this queue from the queue mapping of the rest manager

Defined in

packages/rest/dist/types/queue.d.ts:37


interval

interval: number

The time that discord allows to make the max number of requests. Defaults to 0

Defined in

packages/rest/dist/types/queue.d.ts:10


max

max: number

Max requests for this this. Defaults to 1.

Defined in

packages/rest/dist/types/queue.d.ts:8


pending

pending: SendRequestOptions[]

The requests that are currently pending.

Defined in

packages/rest/dist/types/queue.d.ts:16


processing

processing: boolean

Whether or not the waiting queue is already processing.

Defined in

packages/rest/dist/types/queue.d.ts:18


processingPending

processingPending: boolean

Whether or not the pending queue is already processing.

Defined in

packages/rest/dist/types/queue.d.ts:20


remaining

remaining: number

Amount of requests that have are remaining. Defaults to 1.

Defined in

packages/rest/dist/types/queue.d.ts:6


rest

rest: RestManager

The rest manager

Defined in

packages/rest/dist/types/queue.d.ts:4


timeoutId

timeoutId: undefined | Timeout

timer to reset to 0

Defined in

packages/rest/dist/types/queue.d.ts:12


url

url: string

The url that all the requests in this queue are sent to.

Defined in

packages/rest/dist/types/queue.d.ts:24


waiting

waiting: (value) => void[]

The requests that are currently pending.

Defined in

packages/rest/dist/types/queue.d.ts:14

Accessors

queueType

Get Signature

get queueType(): string

Returns

string

Defined in

packages/rest/dist/types/queue.d.ts:58

Methods

cleanup()

cleanup(): void

Cleans up the queue by checking if there is nothing left and removing it.

Returns

void

Defined in

packages/rest/dist/types/queue.d.ts:55


handleCompletedRequest()

handleCompletedRequest(headers): void

Parameters

headers

headers.interval?: number

headers.max?: number

headers.remaining?: number

Returns

void

Defined in

packages/rest/dist/types/queue.d.ts:47


isQueueClearable()

isQueueClearable(): boolean

Simply checks if the queue is able to be cleared or it has requests pending.

Returns

boolean

Defined in

packages/rest/dist/types/queue.d.ts:57


isRequestAllowed()

isRequestAllowed(): boolean

Check if there is any remaining requests that are allowed.

Returns

boolean

Defined in

packages/rest/dist/types/queue.d.ts:40


makeRequest()

makeRequest(options): Promise<void>

Checks if a request is available and adds it to the queue. Also triggers queue processing if not already processing.

Parameters

options: SendRequestOptions

Returns

Promise<void>

Defined in

packages/rest/dist/types/queue.d.ts:53


processPending()

processPending(): Promise<void>

Process the queue of all requests pending to be sent.

Returns

Promise<void>

Defined in

packages/rest/dist/types/queue.d.ts:46


processWaiting()

processWaiting(): Promise<void>

Process the queue of requests waiting to be handled.

Returns

Promise<void>

Defined in

packages/rest/dist/types/queue.d.ts:44


waitUntilRequestAvailable()

waitUntilRequestAvailable(): Promise<void>

Pauses the execution until a request is allowed to be made.

Returns

Promise<void>

Defined in

packages/rest/dist/types/queue.d.ts:42