diff --git a/lib/utils/action-hook-delay.js b/lib/utils/action-hook-delay.js index 60efdd56..656f8a8f 100644 --- a/lib/utils/action-hook-delay.js +++ b/lib/utils/action-hook-delay.js @@ -2,7 +2,6 @@ const makeTask = require('../tasks/make_task'); const Emitter = require('events'); const { normalizeJambones } = require('@jambonz/verb-specifications'); const {TaskName} = require('../utils/constants'); -const assert = require('assert'); /** * ActionHookDelayProcessor @@ -51,7 +50,7 @@ class ActionHookDelayProcessor extends Emitter { this.actions = opts.actions; this.retries = opts.retries || 0; - this.noResponseTimeout = opts.noResponseTimeout || 0; + this.noResponseTimeout = opts.noResponseTimeout; this.noResponseGiveUpTimeout = opts.noResponseGiveUpTimeout; // return false if these options actually disable the ahdp @@ -66,11 +65,16 @@ class ActionHookDelayProcessor extends Emitter { this.logger.debug('ActionHookDelayProcessor#start: already started due to prior gather which is continuing'); return; } - assert(!this._noResponseTimer); this._active = true; this._retryCount = 0; - const timeoutMs = this.noResponseTimeout === 0 ? 1 : this.noResponseTimeout * 1000; - this._noResponseTimer = setTimeout(this._onNoResponseTimer.bind(this), timeoutMs); + if (this.noResponseTimeout > 0) { + const timeoutMs = this.noResponseTimeout * 1000; + this._noResponseTimer = setTimeout(this._onNoResponseTimer.bind(this), timeoutMs); + } else { + this.logger.debug( + 'ActionHookDelayProcessor#start: noResponseTimeout is 0 or undefined hence not calling _onNoResponseTimer' + ); + } if (this.noResponseGiveUpTimeout > 0) { const timeoutMs = this.noResponseGiveUpTimeout * 1000;