Skip to main content

Queue

@discordeno/restDocs


Documentation / @discordeno/rest / Queue

Class: Queue

Constructors

new Queue()

new Queue(rest, options): Queue

Parameters

rest: RestManager

options: QueueOptions

Returns

Queue

Defined in

rest/src/queue.ts:41

Properties

deleteQueueDelay

deleteQueueDelay: number = 60000

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

Defined in

rest/src/queue.ts:30


deleteQueueTimeout?

optional deleteQueueTimeout: Timeout

The timeout for the deletion of this queue

Defined in

rest/src/queue.ts:32


firstRequest

firstRequest: boolean = false

Whether the first request is pending.

Defined in

rest/src/queue.ts:24


frozenAt

frozenAt: number = 0

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

Defined in

rest/src/queue.ts:28


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

rest/src/queue.ts:39


interval

interval: number = 0

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

Defined in

rest/src/queue.ts:12


max

max: number = 1

Max requests for this this. Defaults to 1.

Defined in

rest/src/queue.ts:10


pending

pending: SendRequestOptions[] = []

The requests that are currently pending.

Defined in

rest/src/queue.ts:18


processing

processing: boolean = false

Whether or not the waiting queue is already processing.

Defined in

rest/src/queue.ts:20


processingPending

processingPending: boolean = false

Whether or not the pending queue is already processing.

Defined in

rest/src/queue.ts:22


remaining

remaining: number = 1

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

Defined in

rest/src/queue.ts:8


rest

rest: RestManager

The rest manager

Defined in

rest/src/queue.ts:6


timeoutId

timeoutId: undefined | Timeout

timer to reset to 0

Defined in

rest/src/queue.ts:14


url

url: string

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

Defined in

rest/src/queue.ts:26


waiting

waiting: (value) => void[] = []

The requests that are currently pending.

Defined in

rest/src/queue.ts:16

Accessors

queueType

Get Signature

get queueType(): string

Returns

string

Defined in

rest/src/queue.ts:218

Methods

cleanup()

cleanup(): void

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

Returns

void

Defined in

rest/src/queue.ts:177


handleCompletedRequest()

handleCompletedRequest(headers): void

Parameters

headers

headers.interval?: number

headers.max?: number

headers.remaining?: number

Returns

void

Defined in

rest/src/queue.ts:151


isQueueClearable()

isQueueClearable(): boolean

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

Returns

boolean

Defined in

rest/src/queue.ts:208


isRequestAllowed()

isRequestAllowed(): boolean

Check if there is any remaining requests that are allowed.

Returns

boolean

Defined in

rest/src/queue.ts:54


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

rest/src/queue.ts:170


processPending()

processPending(): Promise<void>

Process the queue of all requests pending to be sent.

Returns

Promise<void>

Defined in

rest/src/queue.ts:94


processWaiting()

processWaiting(): Promise<void>

Process the queue of requests waiting to be handled.

Returns

Promise<void>

Defined in

rest/src/queue.ts:73


waitUntilRequestAvailable()

waitUntilRequestAvailable(): Promise<void>

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

Returns

Promise<void>

Defined in

rest/src/queue.ts:59