Skip to content

feat(oracles): Add timeout when fetching prices#1576

Open
yordanmadzhunkov wants to merge 2 commits intomainfrom
yordan/add_timeout_when_fetching_prices
Open

feat(oracles): Add timeout when fetching prices#1576
yordanmadzhunkov wants to merge 2 commits intomainfrom
yordan/add_timeout_when_fetching_prices

Conversation

@yordanmadzhunkov
Copy link

Currently a stop in Gate.io caused the whole crypto price oracle to stop working, dispute having available data from other exchanges. This PR adds the ability to handle this kind of situation

]);

let fetched_provider_prices = fetch_all_prices(futures_set).await;
let fetched_provider_prices = fetch_all_prices(futures_set, &Duration::from_secs(5)).await;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How much is the deadline for the whole oracle script to be considered failed due to timeout? Maybe we should aim for an interval that is closer to it. Currently, Binance takes around 30s to fetch prices, sometimes even 40s.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then I should increase this to 59 secs :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, Binance takes around 30s to fetch prices, sometimes even 40s

Where have you examined these numbers?

@yordanmadzhunkov yordanmadzhunkov force-pushed the yordan/add_timeout_when_fetching_prices branch from 840bc81 to 1303f3c Compare August 12, 2025 14:26
]);

let fetched_provider_prices = fetch_all_prices(futures_set).await;
let fetched_provider_prices = fetch_all_prices(futures_set, &Duration::from_secs(15)).await;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we increase this timeout as well, the current voting period of all price feeds is 90 seconds, we could go for the same value as in cex-price-feeds might be?

Copy link
Collaborator

@EmilIvanichkovv EmilIvanichkovv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can not use tokio in wasm.
If you try to run any of the scripts, you will see

 just start-oracle cex-price-feeds
Image

@yordanmadzhunkov yordanmadzhunkov force-pushed the yordan/add_timeout_when_fetching_prices branch from 1303f3c to 6136b52 Compare August 13, 2025 15:08
@github-actions
Copy link

🚀 Deployment Links of Blocksense Network websites:

Website Latest Update Commit
🌱 Documentation 13.08.2025 18:16:57 41e2e01
📖 Docs UI Components 13.08.2025 18:16:57 41e2e01
📝 UI Components 13.08.2025 18:16:57 41e2e01

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

Successfully merging this pull request may close these issues.

5 participants