Skip to content

Commit

Permalink
Force trader poll on idle (#365)
Browse files Browse the repository at this point in the history
* Force trader poll on idle

* Change self to this
  • Loading branch information
RafaelTaranto authored and joshmh committed Jul 31, 2019
1 parent 84b317c commit 6249362
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/brain.js
Expand Up @@ -1319,6 +1319,7 @@ Brain.prototype._idle = function _idle (locale) {

if (this.networkDown) return this._forceNetworkDown()

const pollPromise = this.trader.poll()
this.idVerify.reset()
this.currentPhoneNumber = null
this.currentSecurityCode = null
Expand Down Expand Up @@ -1355,10 +1356,16 @@ Brain.prototype._idle = function _idle (locale) {

this.tx = Tx.update(this.tx, {fiatCode: this.fiatCode})

pollPromise
.then(() => this._idleByMode(this.localeInfo))
.catch(console.log)
}

Brain.prototype._idleByMode = function _idleByMode (localeInfo) {
if (this.trader.twoWayMode) {
this._idleTwoWay(self.localeInfo)
this._idleTwoWay(localeInfo)
} else {
this._idleOneWay(self.localeInfo)
this._idleOneWay(localeInfo)
}
}

Expand Down

0 comments on commit 6249362

Please sign in to comment.