status-sharding
Version:
Welcome to Status Sharding! This package is designed to provide an efficient and flexible solution for sharding Discord bots, allowing you to scale your bot across multiple processes or workers.
33 lines (32 loc) • 980 B
TypeScript
import { QueueOptions } from '../types';
/** Item of the queue. */
export interface QueueItem<A = unknown[]> {
/** Runs the item. */
run(...args: unknown[]): Promise<unknown>;
/** Arguments to pass to the item. */
args: A;
/** Time when the item was added to the queue. */
time?: number;
/** Time to wait until next item. */
timeout: number;
}
/** Queue class. */
export declare class Queue {
options: QueueOptions;
/** Whether the queue is paused. */
private paused;
/** List of items in the queue. */
private queue;
/** Creates an instance of Queue. */
constructor(options: QueueOptions);
/** Starts the queue and run's the item functions. */
start(): Promise<Queue>;
/** Runs the next item in the queue. */
next(): Promise<unknown>;
/** Stops the queue. */
stop(): this;
/** Resumes the queue. */
resume(): this;
/** Adds an item to the queue. */
add(item: QueueItem): this;
}