mirror of
https://github.com/ragestudio/linebridge.git
synced 2025-06-09 10:34:17 +00:00
added axios-retry
support
This commit is contained in:
parent
3e441ded1c
commit
b8926dfdab
@ -21,6 +21,7 @@
|
||||
"@corenode/utils": "0.28.26",
|
||||
"@nanoexpress/middleware-body-parser": "^1.2.2",
|
||||
"axios": "0.27.2",
|
||||
"axios-retry": "^3.3.1",
|
||||
"cors": "2.8.5",
|
||||
"express": "^4.18.1",
|
||||
"hyper-express": "^6.1.1",
|
||||
|
@ -1,4 +1,5 @@
|
||||
const axios = require("axios")
|
||||
const axiosRetry = require("axios-retry")
|
||||
const camalize = require("@corenode/utils/dist/camalize").default
|
||||
|
||||
const { WSInterface } = require("./classes")
|
||||
@ -46,13 +47,20 @@ module.exports = class Bridge {
|
||||
}
|
||||
})
|
||||
|
||||
if (this.params.enableRetry) {
|
||||
axiosRetry(this.httpInterface, {
|
||||
retries: this.params.onFailRetries ?? 1,
|
||||
retryDelay: this.params.retryDelay ?? 0,
|
||||
})
|
||||
}
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
initialize = async () => {
|
||||
const instanceManifest = await this.httpInterface.get("/")
|
||||
.then(res => res.data)
|
||||
.catch(err => {
|
||||
.then((res) => res.data)
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
throw new Error(`Could not get endpoints map from server. [${err.message}]`)
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user