Commit 685b9d9
authored
add timeout to abi request (#209)
### TL;DR
Added HTTP timeout for ABI fetching operations to prevent hanging requests.
### What changed?
- Added a 10-second timeout to the HTTP client used for fetching contract ABIs
- Imported the `time` package to support the timeout functionality
- Replaced the direct `http.Get()` call with a custom client that has timeout configuration
### How to test?
1. Verify that ABI fetching operations complete or fail within 10 seconds
2. Test with a slow or unresponsive API endpoint to confirm the timeout works correctly
3. Ensure existing ABI fetching functionality continues to work normally with responsive endpoints
### Why make this change?
Without a timeout, HTTP requests to fetch contract ABIs could potentially hang indefinitely if the API endpoint is unresponsive, causing resource leaks and degraded performance. This change ensures that requests will fail gracefully after 10 seconds, allowing the system to handle errors appropriately and maintain responsiveness.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **Bug Fixes**
- Improved reliability of contract ABI fetching by adding a timeout to prevent requests from hanging indefinitely.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 file changed
+7
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
37 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
38 | 44 | | |
39 | 45 | | |
40 | 46 | | |
| |||
0 commit comments