pancake-frontend
pancake-frontend copied to clipboard
Update updateLPsAPR.ts
This pull request significantly improves the LP APR fetcher script, making it more robust, efficient, and error-resistant. The enhancements focus on better error handling, improved performance, and more detailed logging.
Key Changes
- Implemented retry mechanism for network requests
- Added concurrent processing with controlled limits
- Enhanced error handling and logging
- Implemented caching for farm configs
- Improved numerical precision and error checking
- Optimized for parallel processing of different chains
- Added detailed execution timing information
Benefits
- More resilient to network issues
- Improved performance through parallel processing and caching
- Better visibility into the execution process
- Safeguards against potential numerical issues
- More maintainable and readable code structure
Testing
The enhanced script has been tested across multiple chains and scenarios to ensure reliability and improved performance.
PR-Codex overview
The focus of this PR is to refactor the fetchAndUpdateLPsAPR
function to improve error handling, retry mechanism, and file writing process.
Detailed summary
- Refactored
fetchAndUpdateLPsAPR
function for better error handling and retry mechanism - Updated file writing process to use
fs/promises
andpath
- Added constants for output directory, max retries, retry delay, and concurrent requests
- Implemented
fetchWithRetry
function for retrying failed requests - Improved logging for successful and failed chain updates
- Cached farm configurations to reduce redundant imports
✨ Ask PR-Codex anything about this PR by commenting with
/codex {your question}