Skip to main content

Queue

Documentation


Documentation / @discordeno/rest / Queue

Class: Queue

Defined in: queue.ts:5

Constructors​

Constructor​

new Queue(rest, options): Queue

Defined in: queue.ts:42

Parameters​

rest​

RestManager

options​

QueueOptions

Returns​

Queue

Properties​

deleteQueueDelay​

deleteQueueDelay: number = 60000

Defined in: queue.ts:31

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


deleteQueueTimeout?​

optional deleteQueueTimeout?: Timeout

Defined in: queue.ts:33

The timeout for the deletion of this queue


firstRequest​

firstRequest: boolean = false

Defined in: queue.ts:25

Whether the first request is pending.


frozenAt​

frozenAt: number = 0

Defined in: queue.ts:29

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


identifier​

identifier: string

Defined in: queue.ts:40

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


interval​

interval: number = 0

Defined in: queue.ts:13

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


max​

max: number = 1

Defined in: queue.ts:11

Max requests for this this. Defaults to 1.


pending​

pending: SendRequestOptions[] = []

Defined in: queue.ts:19

The requests that are currently pending.


processing​

processing: boolean = false

Defined in: queue.ts:21

Whether or not the waiting queue is already processing.


processingPending​

processingPending: boolean = false

Defined in: queue.ts:23

Whether or not the pending queue is already processing.


remaining​

remaining: number = 1

Defined in: queue.ts:9

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


rest​

rest: RestManager

Defined in: queue.ts:7

The rest manager


timeoutId​

timeoutId: Timeout | undefined

Defined in: queue.ts:15

timer to reset to 0


url​

url: string

Defined in: queue.ts:27

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


waiting​

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

Defined in: queue.ts:17

The requests that are currently pending.

Parameters​

value​

void | PromiseLike<void>

Returns​

void

Accessors​

queueType​

Get Signature​

get queueType(): string

Defined in: queue.ts:251

Returns​

string

Methods​

cleanup()​

cleanup(): void

Defined in: queue.ts:210

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

Returns​

void


handleCompletedRequest()​

handleCompletedRequest(headers): void

Defined in: queue.ts:175

Parameters​

headers​
interval?​

number

max?​

number

remaining?​

number

Returns​

void


isQueueClearable()​

isQueueClearable(): boolean

Defined in: queue.ts:241

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

Returns​

boolean


isRequestAllowed()​

isRequestAllowed(): boolean

Defined in: queue.ts:55

Check if there is any remaining requests that are allowed.

Returns​

boolean


makeRequest()​

makeRequest(options): Promise<void>

Defined in: queue.ts:194

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>


processPending()​

processPending(): Promise<void>

Defined in: queue.ts:110

Process the queue of all requests pending to be sent.

Returns​

Promise<void>


processWaiting()​

processWaiting(): Promise<void>

Defined in: queue.ts:86

Process the queue of requests waiting to be handled.

Returns​

Promise<void>


waitUntilRequestAvailable()​

waitUntilRequestAvailable(signal?): Promise<void>

Defined in: queue.ts:60

Pauses the execution until a request is allowed to be made, or until the given signal aborts.

Parameters​

signal?​

AbortSignal

Returns​

Promise<void>