mx-api-service icon indicating copy to clipboard operation
mx-api-service copied to clipboard

[Bug]: often timeout for api

Open sylviahuang123 opened this issue 2 years ago • 7 comments

Contact Details

No response

Description

sometimes happened

Steps to reproduce

curl localhost:3001/api/accounts/erd1uskf6lu8x23mrxfm7gde28jaq6m5wxxws2uw5gf5z6yk6srel7mspeukls/delegation

On which network is the bug manifesting itself?

Mainnet

Relevant log output

Nov 23 08:40:30 sudo[17801]: {"body":null,"context":"ApiService","dd":{"service":"node","span_id":"1221748344080819597","trace_id":"3236560078014969912","version":"0.0.1"},"level":"error","message":"timeout of 30000ms exceeded","method":"GET","name":"AxiosError","timestamp":"2023-11-23T08:40:30.690Z","url":"https://delegation-api.multiversx.com/accounts/erd1uskf6lu8x23mrxfm7gde28jaq6m5wxxws2uw5gf5z6yk6srel7mspeukls/delegations","value":{"body":null,"message":"timeout of 30000ms exceeded","method":"GET","name":"AxiosError","url":"https://delegation-api.multiversx.com/accounts/erd1uskf6lu8x23mrxfm7gde28jaq6m5wxxws2uw5gf5z6yk6srel7mspeukls/delegations"}}
Nov 23 08:40:30 sudo[17801]: {"context":"DelegationService:AccountController.getDelegationForAddress","dd":{"service":"node","span_id":"1221748344080819597","trace_id":"3236560078014969912","version":"0.0.1"},"level":"error","message":"Error when getting account delegation details for address erd1uskf6lu8x23mrxfm7gde28jaq6m5wxxws2uw5gf5z6yk6srel7mspeukls","stack":["Error: \n    at OriginLogger.error (/mx-api-service/node_modules/@multiversx/sdk-nestjs-common/src/utils/origin.logger.ts:29:68)\n    at DelegationService.getDelegationForAddress (/mx-api-service/src/endpoints/delegation/delegation.service.ts:75:19)\n    at processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at AccountController.getDelegationForAddress (/mx-api-service/src/endpoints/accounts/account.controller.ts:606:12)"],"timestamp":"2023-11-23T08:40:30.691Z"}
Nov 23 08:40:30 sudo[17801]: {"body":null,"context":"DelegationService:AccountController.getDelegationForAddress","dd":{"service":"node","span_id":"1221748344080819597","trace_id":"3236560078014969912","version":"0.0.1"},"level":"error","message":"timeout of 30000ms exceeded","method":"GET","name":"AxiosError","timestamp":"2023-11-23T08:40:30.691Z","url":"https://delegation-api.multiversx.com/accounts/erd1uskf6lu8x23mrxfm7gde28jaq6m5wxxws2uw5gf5z6yk6srel7mspeukls/delegations","value":{"body":null,"message":"timeout of 30000ms exceeded","method":"GET","name":"AxiosError","url":"https://delegation-api.multiversx.com/accounts/erd1uskf6lu8x23mrxfm7gde28jaq6m5wxxws2uw5gf5z6yk6srel7mspeukls/delegations"}}


### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

sylviahuang123 avatar Nov 23 '23 08:11 sylviahuang123

Hi, thanks for reporting this issue with delegation timeout, we will try to reproduce this behavior and we will apply an proper fix

cfaur09 avatar Nov 23 '23 09:11 cfaur09

Hi, thanks for reporting this issue with delegation timeout, we will try to reproduce this behavior and we will apply an proper fix

hello, any update?

sylviahuang123 avatar Dec 01 '23 01:12 sylviahuang123

are you performing a lot of repeated requests towards the delegation api? we have some rate limiters that might affect this

if you want to query the delegation information for multiple addresses, you can use the elasticsearch now which is much more performant and can fetch multiple infos at the same time: https://index.multiversx.com/delegators/_search

tanghel avatar Jan 04 '24 07:01 tanghel

no, it's just one address as I shared curl localhost:3001/api/accounts/erd1uskf6lu8x23mrxfm7gde28jaq6m5wxxws2uw5gf5z6yk6srel7mspeukls/delegation few address we're using

sylviahuang123 avatar Jan 08 '24 03:01 sylviahuang123

but where to see these fields? can't find in Elasticsearch

"userUnBondable": "0",
"claimableRewards": "46007834661318968",
"userUndelegatedList": []

sylviahuang123 avatar Jan 08 '24 14:01 sylviahuang123

did your try to use Elasticsearch?

curl --request GET \
  --url ${ES_URL}/delegators/_search \
  --header 'Content-Type: application/json' \
  --data '{
    "query": {
        "match": {
            "contract":"erd.."
        }
    }
}'

cfaur09 avatar Jan 09 '24 09:01 cfaur09

yep, of cause I tried, my question is these fields are not equal to API localhost:3001/api/accounts/erd1uskf6lu8x23mrxfm7gde28jaq6m5wxxws2uw5gf5z6yk6srel7mspeukls/delegation, so I can't replace it.

{
"_index": "delegators-000001",
"_type": "_doc",
"_id": "pT8DW9QP9MwQ1NpEI1EnWcK6zL1e+JNKcTbqNNesdMY=",
"_score": 4.438722,
"_source": {
"address": "erd1t79j33ttyty0alttuvumpty0x0safpfeuhnup35thqgpy4dvkjyqsx7vq4",
"contract": "erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqhllllsajxzat",
"activeStake": "52500000000000000000000",
"activeStakeNum": 52500,
"timestamp": 1694158802
}
}

sylviahuang123 avatar Jan 11 '24 08:01 sylviahuang123