Queue
@discordeno/rest • Docs
Documentation / @discordeno/rest / Queue
Class: Queue
Constructors
new Queue()
new Queue(
rest
,options
):Queue
Parameters
• rest: RestManager
• options: QueueOptions
Returns
Defined in
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
deleteQueueTimeout?
optional
deleteQueueTimeout:Timeout
The timeout for the deletion of this queue
Defined in
firstRequest
firstRequest:
boolean
=false
Whether the first request is pending.
Defined in
frozenAt
frozenAt:
number
=0
When requests started being made to determine when the interval will reset it.
Defined in
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
interval
interval:
number
=0
The time that discord allows to make the max number of requests. Defaults to 0
Defined in
max
max:
number
=1
Max requests for this this. Defaults to 1.
Defined in
pending
pending:
SendRequestOptions
[] =[]
The requests that are currently pending.
Defined in
processing
processing:
boolean
=false
Whether or not the waiting queue is already processing.
Defined in
processingPending
processingPending:
boolean
=false
Whether or not the pending queue is already processing.
Defined in
remaining
remaining:
number
=1
Amount of requests that have are remaining. Defaults to 1.
Defined in
rest
rest:
RestManager
The rest manager
Defined in
timeoutId
timeoutId:
undefined
|Timeout
timer to reset to 0
Defined in
url
url:
string
The url that all the requests in this queue are sent to.
Defined in
waiting
waiting: (
value
) =>void
[] =[]
The requests that are currently pending.
Defined in
Accessors
queueType
Get Signature
get queueType():
string
Returns
string
Defined in
Methods
cleanup()
cleanup():
void
Cleans up the queue by checking if there is nothing left and removing it.
Returns
void
Defined in
handleCompletedRequest()
handleCompletedRequest(
headers
):void
Parameters
• headers
• headers.interval?: number
• headers.max?: number
• headers.remaining?: number
Returns
void
Defined in
isQueueClearable()
isQueueClearable():
boolean
Simply checks if the queue is able to be cleared or it has requests pending.
Returns
boolean
Defined in
isRequestAllowed()
isRequestAllowed():
boolean
Check if there is any remaining requests that are allowed.
Returns
boolean
Defined in
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
processPending()
processPending():
Promise
<void
>
Process the queue of all requests pending to be sent.
Returns
Promise
<void
>
Defined in
processWaiting()
processWaiting():
Promise
<void
>
Process the queue of requests waiting to be handled.
Returns
Promise
<void
>
Defined in
waitUntilRequestAvailable()
waitUntilRequestAvailable():
Promise
<void
>
Pauses the execution until a request is allowed to be made.
Returns
Promise
<void
>