finally fixed the timeout hack for tests

This commit is contained in:
Kevin Jahns
2015-11-18 16:17:59 +01:00
parent 5fcfbbfe94
commit 8ee563f873
4 changed files with 55 additions and 57 deletions

View File

@@ -318,9 +318,23 @@ module.exports = function (Y) {
}
}
}
whenTransactionsFinished () {
if (this.transactionInProgress) {
if (this.transactionsFinished == null) {
this.transactionsFinished = Promise.defer()
}
return this.transactionsFinished.promise
} else {
return Promise.resolve()
}
}
getNextRequest () {
if (this.waitingTransactions.length === 0) {
this.transactionInProgress = false
if (this.transactionsFinished != null) {
this.transactionsFinished.resolve()
this.transactionsFinished = null
}
return null
} else {
return this.waitingTransactions.shift()