Skip to content

Commit

Permalink
Allows timeout for backed request (#759)
Browse files Browse the repository at this point in the history
* Allows timeout for backed request
Just a little change for allows define timeout on default.json based on ADempiere request

* Validate 0
  • Loading branch information
yamelsenih authored Apr 19, 2021
1 parent 2ceb553 commit e9596d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
},
"adempiere": {
"api": {
"url": "https://api.erpya.com/adempiere-api"
"url": "https://api.erpya.com/adempiere-api",
"timeout": 100000
},
"images": {
"url": "https://api.erpya.com/adempiere-api/img"
Expand Down
4 changes: 4 additions & 0 deletions src/utils/ADempiere/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ export function request(requestValues) {
requestValues.params = {}
}
requestValues.baseURL = config.adempiere.api.url
// Timeout
if (config.adempiere.api.timeout && config.adempiere.api.timeout > 0) {
requestValues.timeout = config.adempiere.api.timeout
}
requestValues.params.token = getToken()
requestValues.params.language = getLanguage() || 'en_US'
return new Promise(resolve => {
Expand Down

0 comments on commit e9596d0

Please sign in to comment.