Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: often timeout for api #1152

Open
sylviahuang123 opened this issue Nov 23, 2023 · 7 comments
Open

[Bug]: often timeout for api #1152

sylviahuang123 opened this issue Nov 23, 2023 · 7 comments

Comments

@sylviahuang123
Copy link

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
@cfaur09
Copy link
Contributor

cfaur09 commented Nov 23, 2023

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

@sylviahuang123
Copy link
Author

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?

@tanghel
Copy link
Contributor

tanghel commented Jan 4, 2024

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

@sylviahuang123
Copy link
Author

sylviahuang123 commented Jan 8, 2024

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

@sylviahuang123
Copy link
Author

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

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

@cfaur09
Copy link
Contributor

cfaur09 commented Jan 9, 2024

did your try to use Elasticsearch?

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

@sylviahuang123
Copy link
Author

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
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants