Commit 5692b27
authored
refactor: use run_in_threadpool for asset service calls in watchlist router (ValueCell-ai#220)
## 📝 Pull Request Template
### 1. Related Issue
Closes ValueCell-ai#219
### Type of Change (select one)
Performance
### 3. Description
Wrapped blocking service calls in the watchlist router with Starlette’s
run_in_threadpool to avoid event-loop blocking caused by synchronous
underlying libraries (e.g., yfinance).
Added the import and updated these async routes:
- GET /asset/search
- GET /asset/{ticker}
- GET /asset/{ticker}/price
- GET /{watchlist_name}
- GET /asset/{ticker}/price/historical.
### 4. Testing
- [x] I have tested this locally.
- [x] I have updated or added relevant tests.
### 5. Checklist
- [x] I have read the [Code of Conduct](./CODE_OF_CONDUCT.md)
- [x] I have followed the [Contributing Guidelines](./CONTRIBUTING.md)
- [x] My changes follow the project's coding style1 parent 424f69b commit 5692b27
1 file changed
Lines changed: 18 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
63 | | - | |
| 64 | + | |
| 65 | + | |
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
| |||
106 | 108 | | |
107 | 109 | | |
108 | 110 | | |
109 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
110 | 114 | | |
111 | 115 | | |
112 | 116 | | |
| |||
145 | 149 | | |
146 | 150 | | |
147 | 151 | | |
148 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
149 | 155 | | |
150 | 156 | | |
151 | 157 | | |
| |||
225 | 231 | | |
226 | 232 | | |
227 | 233 | | |
228 | | - | |
| 234 | + | |
| 235 | + | |
229 | 236 | | |
230 | 237 | | |
231 | 238 | | |
| |||
517 | 524 | | |
518 | 525 | | |
519 | 526 | | |
520 | | - | |
521 | | - | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
522 | 534 | | |
523 | 535 | | |
524 | 536 | | |
| |||
0 commit comments