chore(Xapi#_transportCall): simplify and improve code
It may even fixes some issues.
This commit is contained in:
parent
59d9b3c6b4
commit
ab6b1e2c32
@ -418,8 +418,9 @@ export class Xapi extends EventEmitter {
|
||||
}
|
||||
|
||||
// Low level call: handle transport errors.
|
||||
_transportCall (method, args, startTime = Date.now(), tries = 1) {
|
||||
return this._rawCall(method, args)
|
||||
_transportCall (method, args) {
|
||||
let tries = 1
|
||||
const loop = () => this._rawCall(method, args)
|
||||
::pCatch(isNetworkError, isXapiNetworkError, error => {
|
||||
debug('%s: network error %s', this._humanId, error.code)
|
||||
|
||||
@ -447,7 +448,9 @@ export class Xapi extends EventEmitter {
|
||||
|
||||
return this._transportCall(method, args, startTime)
|
||||
})
|
||||
.then(
|
||||
|
||||
const startTime = Date.now()
|
||||
return loop().then(
|
||||
result => {
|
||||
debug(
|
||||
'%s: %s(...) [%s] ==> %s',
|
||||
|
Loading…
Reference in New Issue
Block a user