-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Native price fetching finishing touches (#3030)
# Description This PR addresses the last known issues with native price fetching: lock contention and spikes of expired orders. # Changes ## Reduce Lock Contention #2987 made it such that we can now fetch missing prices while building the auction. However, the implementation resulted in too much lock contention. Previously we locked the cache once and returned all relevant prices and now we lock it at least once per fetched price. To fix that we first use the optimized function which only takes one lock and then we use the generic implementation that locks on every token. Since we started initializing the native price cache by loading prices from the DB we should rarely have many prices expire together so this should be fine. Already confirmed to be working with a hotfixed prod release. ## Reduce Spikes of Expired Prices So far all prices we initialized the cache with expire together. This can lead to a few spikes of prices expiring together where the update logic can't refresh them in time which leads to expired orders. To address that we generate random `updated_at` timestamps between 50% and 90% expired. That way the background task should never get overwhelmed by updating too many prices at once. ## How to test Tested in prod
- Loading branch information
1 parent
c34f150
commit 7d68eff
Showing
3 changed files
with
40 additions
and
13 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters