From 13e2959ded3793838c2be878902649107ba9a1c6 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Sat, 22 May 2021 13:57:54 +0300 Subject: [PATCH] Add getter for Queue.timeout --- backend/src/Queue.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/backend/src/Queue.ts b/backend/src/Queue.ts index cf507a22..b8445f12 100644 --- a/backend/src/Queue.ts +++ b/backend/src/Queue.ts @@ -8,10 +8,14 @@ const DEFAULT_TIMEOUT = 10 * SECONDS; export class Queue { protected running = false; protected queue: InternalQueueFn[] = []; - protected timeout: number; + protected _timeout: number; constructor(timeout = DEFAULT_TIMEOUT) { - this.timeout = timeout; + this._timeout = timeout; + } + + get timeout(): number { + return this._timeout; } /** @@ -49,7 +53,7 @@ export class Queue { new Promise(resolve => { // Either fn() completes or the timeout is reached void fn().then(resolve); - setTimeout(resolve, this.timeout); + setTimeout(resolve, this._timeout); }).then(() => this.next()); }