1
0
mirror of https://github.com/bigchaindb/js-bigchaindb-driver.git synced 2024-11-22 01:36:56 +01:00

fix: improve promises handling

This commit is contained in:
getlarge 2022-02-15 08:06:31 +01:00
parent 34289b0640
commit 38819a5934
No known key found for this signature in database
GPG Key ID: E4E13243600F9566

View File

@ -70,7 +70,7 @@ export default class Request {
const requestTimeout = timeout ? timeout - backoffTimedelta : timeout
return baseRequest(apiUrl, requestConfig, requestTimeout)
.then(async (res) => {
.then((res) => {
this.connectionError = null
return res.json()
})
@ -111,6 +111,8 @@ export default class Request {
}
static sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms))
return new Promise(resolve => {
setTimeout(resolve, ms)
})
}
}