feat: make author clickable
This commit is contained in:
@@ -80,3 +80,26 @@ export class PromiseQueue {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
export class ConcurrentPromiseQueue {
|
||||
/**
|
||||
* Eingereihte Promises.
|
||||
*/
|
||||
private queues: PromiseQueue[] = [];
|
||||
|
||||
constructor(concurrency: number) {
|
||||
this.queues = Array.from({ length: concurrency }).map(() => {
|
||||
return new PromiseQueue();
|
||||
});
|
||||
}
|
||||
|
||||
private queueIndex = 0;
|
||||
private getQueue() {
|
||||
this.queueIndex = (this.queueIndex + 1) % this.queues.length;
|
||||
return this.queues[this.queueIndex];
|
||||
}
|
||||
|
||||
public enqueue<T = void>(promise: () => Promise<T>): Promise<T> {
|
||||
return this.getQueue().enqueue(promise);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user