mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
Fix: REST dial timeout (#351)
* Fix #343 by cancelling the request if the session isn't available * Commit that works for 302's calls --------- Co-authored-by: Matt Preskett <matt.preskett@netcall.com>
This commit is contained in:
@@ -28,6 +28,7 @@ class TaskRestDial extends Task {
|
|||||||
*/
|
*/
|
||||||
async exec(cs) {
|
async exec(cs) {
|
||||||
await super.exec(cs);
|
await super.exec(cs);
|
||||||
|
this.cs = cs;
|
||||||
this.canCancel = true;
|
this.canCancel = true;
|
||||||
|
|
||||||
this._setCallTimer();
|
this._setCallTimer();
|
||||||
@@ -37,9 +38,9 @@ class TaskRestDial extends Task {
|
|||||||
kill(cs) {
|
kill(cs) {
|
||||||
super.kill(cs);
|
super.kill(cs);
|
||||||
this._clearCallTimer();
|
this._clearCallTimer();
|
||||||
if (this.canCancel && cs?.req) {
|
if (this.canCancel) {
|
||||||
this.canCancel = false;
|
this.canCancel = false;
|
||||||
cs.req.cancel();
|
cs?.req?.cancel();
|
||||||
}
|
}
|
||||||
this.notifyTaskDone();
|
this.notifyTaskDone();
|
||||||
}
|
}
|
||||||
@@ -98,7 +99,7 @@ class TaskRestDial extends Task {
|
|||||||
_onCallTimeout() {
|
_onCallTimeout() {
|
||||||
this.logger.debug('TaskRestDial: timeout expired without answer, killing task');
|
this.logger.debug('TaskRestDial: timeout expired without answer, killing task');
|
||||||
this.timer = null;
|
this.timer = null;
|
||||||
this.kill();
|
this.kill(this.cs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user