From fe2af84b21d49e2d87247dd4cb0b078371c3dfa1 Mon Sep 17 00:00:00 2001 From: Alan Date: Thu, 26 Jan 2023 12:47:17 -0300 Subject: [PATCH] fix(basic.gblib): OPEN keyword fix. Magic number removal. --- packages/basic.gblib/services/DialogKeywords.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/basic.gblib/services/DialogKeywords.ts b/packages/basic.gblib/services/DialogKeywords.ts index 8cdda461..a1458e51 100644 --- a/packages/basic.gblib/services/DialogKeywords.ts +++ b/packages/basic.gblib/services/DialogKeywords.ts @@ -57,12 +57,17 @@ import sgMail from '@sendgrid/mail'; import mammoth from 'mammoth'; import qrcode from 'qrcode'; import { json } from 'body-parser'; + +/** + * Default check interval for user replay + */ + const DEFAULT_HEAR_POLL_INTERVAL = 500; /** * Base services of conversation to be called by BASIC. */ export class DialogKeywords { - /** + /** * Reference to minimal bot instance. */ public min: GBMinInstance; @@ -86,7 +91,6 @@ export class DialogKeywords { * The number used in this execution for HEAR calls (useful for SET SCHEDULE). */ hrOn: string; - userId: GuaribasUser; debugWeb: boolean; lastDebugWeb: Date; @@ -805,7 +809,7 @@ export class DialogKeywords { min.cbMap[userId]['promise'] = '!GBHEAR'; while (min.cbMap[userId].promise === '!GBHEAR') { - await sleep(500); + await sleep(DEFAULT_HEAR_POLL_INTERVAL); } const text = min.cbMap[userId].promise;