mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
Feature/gather enhancements (#73)
* add bargein support to gather * bugfix: gather handles interim results from azure * gather: support for min/max digits and interdigit timeout * add task summary to some log messages * logging improvements
This commit is contained in:
@@ -58,7 +58,7 @@ class WsRequestor extends BaseRequestor {
|
||||
const rtt = this._roundTrip(startAt);
|
||||
this.stats.histogram('app.hook.connect_time', rtt, ['hook_type:app']);
|
||||
} catch (err) {
|
||||
this.logger.error({err}, 'WsRequestor:request - failed connecting');
|
||||
this.logger.info({url, err}, 'WsRequestor:request - failed connecting');
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
@@ -137,11 +137,12 @@ class WsRequestor extends BaseRequestor {
|
||||
.once('ready', (ws) => {
|
||||
this.ws = ws;
|
||||
this.removeAllListeners('not-ready');
|
||||
this.connections++;
|
||||
resolve();
|
||||
})
|
||||
.once('not-ready', () => {
|
||||
.once('not-ready', (err) => {
|
||||
this.removeAllListeners('ready');
|
||||
reject();
|
||||
reject(err);
|
||||
});
|
||||
const ws = new Websocket(this.url, ['ws.jambonz.org'], opts);
|
||||
this._setHandlers(ws);
|
||||
@@ -158,9 +159,11 @@ class WsRequestor extends BaseRequestor {
|
||||
}
|
||||
|
||||
_onError(err) {
|
||||
this.logger.info({url: this.url, err}, 'WsRequestor:_onError');
|
||||
if (this.connections > 0) this.emit('socket-closed');
|
||||
this.emit('not-ready');
|
||||
if (this.connections > 0) {
|
||||
this.logger.info({url: this.url, err}, 'WsRequestor:_onError');
|
||||
if (this.connections > 0) this.emit('socket-closed');
|
||||
}
|
||||
else this.emit('not-ready', err);
|
||||
}
|
||||
|
||||
_onOpen(ws) {
|
||||
@@ -170,8 +173,10 @@ class WsRequestor extends BaseRequestor {
|
||||
}
|
||||
|
||||
_onClose() {
|
||||
this.logger.info({url: this.url}, 'WsRequestor - socket closed unexpectedly from remote side');
|
||||
this.emit('socket-closed');
|
||||
if (this.connections > 0) {
|
||||
this.logger.info({url: this.url}, 'WsRequestor - socket closed unexpectedly from remote side');
|
||||
this.emit('socket-closed');
|
||||
}
|
||||
}
|
||||
|
||||
_onUnexpectedResponse(ws, req, res) {
|
||||
@@ -182,7 +187,7 @@ class WsRequestor extends BaseRequestor {
|
||||
statusMessage: res.statusMessage
|
||||
}, 'WsRequestor - unexpected response');
|
||||
this.emit('connection-failure');
|
||||
this.emit('not-ready');
|
||||
this.emit('not-ready', new Error(`${res.statusCode} ${res.statusMessage}`));
|
||||
}
|
||||
|
||||
_onSocketClosed() {
|
||||
|
||||
Reference in New Issue
Block a user