3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

Queue: allow overriding queue timeout

This commit is contained in:
Dragory 2019-02-23 21:19:46 +02:00
parent 6f95b7d006
commit 76b9cb6b0c

View file

@ -1,9 +1,15 @@
type QueueFn = (...args: any[]) => Promise<any>;
const DEFAULT_TIMEOUT = 10 * 1000;
export class Queue {
protected running: boolean = false;
protected queue: QueueFn[] = [];
protected timeout: number = 10 * 1000;
protected timeout: number;
constructor(timeout = DEFAULT_TIMEOUT) {
this.timeout = timeout;
}
public add(fn) {
const promise = new Promise(resolve => {