Commit 5f98eb0
committed
fix: use async features in _validate_document_file
Code quality improvement:
- Add asyncio import for async operations
- Wrap blocking file operations (os.path.exists, os.path.getsize) with asyncio.to_thread()
- Keep string operations synchronous as they don't block
- Function now properly uses async features instead of being unnecessarily async
Benefits:
- Properly async: uses await for blocking I/O operations
- Non-blocking: file system operations run in thread pool
- Maintains async contract: function is truly asynchronous
- Better performance: doesn't block the event loop during file checks1 parent a3214a8 commit 5f98eb0
1 file changed
Lines changed: 7 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
563 | 564 | | |
564 | 565 | | |
565 | 566 | | |
566 | | - | |
567 | | - | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
568 | 571 | | |
569 | 572 | | |
570 | | - | |
| 573 | + | |
571 | 574 | | |
572 | 575 | | |
573 | 576 | | |
574 | 577 | | |
575 | 578 | | |
576 | 579 | | |
| 580 | + | |
577 | 581 | | |
578 | 582 | | |
579 | 583 | | |
| |||
0 commit comments