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) {
|
||||
await super.exec(cs);
|
||||
this.cs = cs;
|
||||
this.canCancel = true;
|
||||
|
||||
this._setCallTimer();
|
||||
@@ -37,9 +38,9 @@ class TaskRestDial extends Task {
|
||||
kill(cs) {
|
||||
super.kill(cs);
|
||||
this._clearCallTimer();
|
||||
if (this.canCancel && cs?.req) {
|
||||
if (this.canCancel) {
|
||||
this.canCancel = false;
|
||||
cs.req.cancel();
|
||||
cs?.req?.cancel();
|
||||
}
|
||||
this.notifyTaskDone();
|
||||
}
|
||||
@@ -98,7 +99,7 @@ class TaskRestDial extends Task {
|
||||
_onCallTimeout() {
|
||||
this.logger.debug('TaskRestDial: timeout expired without answer, killing task');
|
||||
this.timer = null;
|
||||
this.kill();
|
||||
this.kill(this.cs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user