Skip to main content

Queue

@discordeno/rest


Documentation / @discordeno/rest / Queue

Class: Queue

Defined in: rest/src/queue.ts:4

Constructors

new Queue()

new Queue(rest, options): Queue

Defined in: rest/src/queue.ts:41

Parameters

rest

RestManager

options

QueueOptions

Returns

Queue

Properties

deleteQueueDelay

deleteQueueDelay: number = 60000

Defined in: rest/src/queue.ts:30

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: rest/src/queue.ts:32

The timeout for the deletion of this queue


firstRequest

firstRequest: boolean = false

Defined in: rest/src/queue.ts:24

Whether the first request is pending.


frozenAt

frozenAt: number = 0

Defined in: rest/src/queue.ts:28

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


identifier

identifier: string

Defined in: rest/src/queue.ts:39

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: rest/src/queue.ts:12

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


max

max: number = 1

Defined in: rest/src/queue.ts:10

Max requests for this this. Defaults to 1.


pending

pending: SendRequestOptions[] = []

Defined in: rest/src/queue.ts:18

The requests that are currently pending.


processing

processing: boolean = false

Defined in: rest/src/queue.ts:20

Whether or not the waiting queue is already processing.


processingPending

processingPending: boolean = false

Defined in: rest/src/queue.ts:22

Whether or not the pending queue is already processing.


remaining

remaining: number = 1

Defined in: rest/src/queue.ts:8

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


rest

rest: RestManager

Defined in: rest/src/queue.ts:6

The rest manager


timeoutId

timeoutId: undefined | Timeout

Defined in: rest/src/queue.ts:14

timer to reset to 0


url

url: string

Defined in: rest/src/queue.ts:26

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


waiting

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

Defined in: rest/src/queue.ts:16

The requests that are currently pending.

Parameters

value

void | PromiseLike<void>

Returns

void

Accessors

queueType

Get Signature

get queueType(): string

Defined in: rest/src/queue.ts:218

Returns

string

Methods

cleanup()

cleanup(): void

Defined in: rest/src/queue.ts:177

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

Returns

void


handleCompletedRequest()

handleCompletedRequest(headers): void

Defined in: rest/src/queue.ts:151

Parameters

headers
interval

number

max

number

remaining

number

Returns

void


isQueueClearable()

isQueueClearable(): boolean

Defined in: rest/src/queue.ts:208

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

Returns

boolean


isRequestAllowed()

isRequestAllowed(): boolean

Defined in: rest/src/queue.ts:54

Check if there is any remaining requests that are allowed.

Returns

boolean


makeRequest()

makeRequest(options): Promise<void>

Defined in: rest/src/queue.ts:170

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: rest/src/queue.ts:94

Process the queue of all requests pending to be sent.

Returns

Promise<void>


processWaiting()

processWaiting(): Promise<void>

Defined in: rest/src/queue.ts:73

Process the queue of requests waiting to be handled.

Returns

Promise<void>


waitUntilRequestAvailable()

waitUntilRequestAvailable(): Promise<void>

Defined in: rest/src/queue.ts:59

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

Returns

Promise<void>