feat(Xapi#_watchEvents): timeout request after 10mins (#44)
This commit is contained in:
parent
a881090e65
commit
f9f9c16cb0
@ -50,7 +50,7 @@
|
||||
"make-error": "^1.0.2",
|
||||
"minimist": "^1.1.1",
|
||||
"ms": "^0.7.1",
|
||||
"promise-toolbox": "^0.5.0",
|
||||
"promise-toolbox": "^0.5.1",
|
||||
"pw": "0.0.4",
|
||||
"source-map-support": "^0.4.0",
|
||||
"trace": "^2.0.1",
|
||||
|
@ -13,7 +13,8 @@ import { EventEmitter } from 'events'
|
||||
import {
|
||||
catchPlus as pCatch,
|
||||
delay as pDelay,
|
||||
promisify
|
||||
promisify,
|
||||
timeout as pTimeout
|
||||
} from 'promise-toolbox'
|
||||
import {
|
||||
createClient as createXmlRpcClient,
|
||||
@ -610,11 +611,13 @@ export class Xapi extends EventEmitter {
|
||||
}
|
||||
|
||||
_watchEvents () {
|
||||
const loop = () => this._sessionCall('event.from', [
|
||||
const call = () => this._sessionCall('event.from', [
|
||||
['*'],
|
||||
this._fromToken,
|
||||
1e3 + 0.1 // Force float.
|
||||
]).then(onSuccess, onFailure)
|
||||
])::pTimeout(600, call)
|
||||
|
||||
const loop = () => call().then(onSuccess, onFailure)
|
||||
|
||||
const onSuccess = ({token, events}) => {
|
||||
this._fromToken = token
|
||||
|
Loading…
Reference in New Issue
Block a user