mirror of
https://github.com/bigchaindb/js-bigchaindb-driver.git
synced 2024-11-24 19:10:12 +01:00
fix: improve promises handling
This commit is contained in:
parent
34289b0640
commit
38819a5934
@ -70,7 +70,7 @@ export default class Request {
|
|||||||
|
|
||||||
const requestTimeout = timeout ? timeout - backoffTimedelta : timeout
|
const requestTimeout = timeout ? timeout - backoffTimedelta : timeout
|
||||||
return baseRequest(apiUrl, requestConfig, requestTimeout)
|
return baseRequest(apiUrl, requestConfig, requestTimeout)
|
||||||
.then(async (res) => {
|
.then((res) => {
|
||||||
this.connectionError = null
|
this.connectionError = null
|
||||||
return res.json()
|
return res.json()
|
||||||
})
|
})
|
||||||
@ -111,6 +111,8 @@ export default class Request {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static sleep(ms) {
|
static sleep(ms) {
|
||||||
return new Promise(resolve => setTimeout(resolve, ms))
|
return new Promise(resolve => {
|
||||||
|
setTimeout(resolve, ms)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user