Skip to content
This repository has been archived by the owner on Mar 3, 2022. It is now read-only.

Commit

Permalink
fix(mosHandler): do not reject in initialization before connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Balte de Wit committed Aug 20, 2018
1 parent 35b9108 commit 9997306
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/mosHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,19 @@ export class MosHandler {

this._ownMosDevices[deviceId] = mosDevice

return mosDevice.getMachineInfo()
const getMachineInfoUntilConnected = () => mosDevice.getMachineInfo().catch((e) => {
if (e === 'No connection available for failover') {
return new Promise((resolve) => {
setTimeout(() => {
resolve(getMachineInfoUntilConnected())
}, 2000)
})
} else {
return e
}
})

return getMachineInfoUntilConnected()
.then((machInfo) => {
this._logger.info('Connected to Mos-device', machInfo)
let machineId = machInfo.ID.toString()
Expand Down

0 comments on commit 9997306

Please sign in to comment.