mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
Feat/893: Made noResponseTimeout and noResponseGiveUpTimeout independent (#896)
* feat/893: made noResponseTimeout and noResponseGiveUpTimout independent * feat/893: not assuming 0 if noResponseTimeout is not specified
This commit is contained in:
@@ -2,7 +2,6 @@ const makeTask = require('../tasks/make_task');
|
|||||||
const Emitter = require('events');
|
const Emitter = require('events');
|
||||||
const { normalizeJambones } = require('@jambonz/verb-specifications');
|
const { normalizeJambones } = require('@jambonz/verb-specifications');
|
||||||
const {TaskName} = require('../utils/constants');
|
const {TaskName} = require('../utils/constants');
|
||||||
const assert = require('assert');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ActionHookDelayProcessor
|
* ActionHookDelayProcessor
|
||||||
@@ -51,7 +50,7 @@ class ActionHookDelayProcessor extends Emitter {
|
|||||||
|
|
||||||
this.actions = opts.actions;
|
this.actions = opts.actions;
|
||||||
this.retries = opts.retries || 0;
|
this.retries = opts.retries || 0;
|
||||||
this.noResponseTimeout = opts.noResponseTimeout || 0;
|
this.noResponseTimeout = opts.noResponseTimeout;
|
||||||
this.noResponseGiveUpTimeout = opts.noResponseGiveUpTimeout;
|
this.noResponseGiveUpTimeout = opts.noResponseGiveUpTimeout;
|
||||||
|
|
||||||
// return false if these options actually disable the ahdp
|
// 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');
|
this.logger.debug('ActionHookDelayProcessor#start: already started due to prior gather which is continuing');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
assert(!this._noResponseTimer);
|
|
||||||
this._active = true;
|
this._active = true;
|
||||||
this._retryCount = 0;
|
this._retryCount = 0;
|
||||||
const timeoutMs = this.noResponseTimeout === 0 ? 1 : this.noResponseTimeout * 1000;
|
if (this.noResponseTimeout > 0) {
|
||||||
|
const timeoutMs = this.noResponseTimeout * 1000;
|
||||||
this._noResponseTimer = setTimeout(this._onNoResponseTimer.bind(this), timeoutMs);
|
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) {
|
if (this.noResponseGiveUpTimeout > 0) {
|
||||||
const timeoutMs = this.noResponseGiveUpTimeout * 1000;
|
const timeoutMs = this.noResponseGiveUpTimeout * 1000;
|
||||||
|
|||||||
Reference in New Issue
Block a user