Discord Player

AsyncQueue

No description provided

AsyncQueue

new AsyncQueue();

Properties

public entries: any

The queued entries

public exceptionHandler: any

public size: any

The total number of entries in this queue. Returns 0 if no entries are available.

Methods

public acquire(options?): AsyncQueueEntry

Acquire an entry.

// lock the queue
const entry = asyncQueue.acquire();
// wait until previous task is completed
await entry.getTask();
// do something expensive
await performSomethingExpensive();
// make sure to release the lock once done
asyncQueue.release();
ParameterTypeOptional
optionsAsyncQueueAcquisitionOptions

public cancelAll(): void

Cancel all entries

public clear(consume): void

Clear entries queue

ParameterTypeOptionalDescription
consumebooleanWhether or not to consume all entries before clearing

public release(): void

Release the current acquisition and move to next entry.

public removeEntry(entry): boolean

Remove the given entry from the queue

ParameterTypeOptionalDescription
entryAsyncQueueEntryThe entry to remove

On this page