Skip to content

Commit a960506

Browse files
committed
Fix prepdocs to properly close async clients
1 parent d2a748d commit a960506

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

.github/chatmodes/fixer.chatmode.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ You MUST check task output readiness before debugging, testing, or declaring wor
2626
- If watchers seem stuck or output stops updating, stop the tasks and run the "Development" task again.
2727
- To interact with a running application, use the Playwright MCP server
2828

29+
## Running Python scripts
30+
31+
If you are running Python scripts that depend on installed requirements, you must run them using the virtual environment in `.venv`.
32+
2933
## Committing the change
3034

3135
When change is complete, offer to make a new branch, git commit, and pull request.

app/backend/prepdocs.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,5 +596,14 @@ async def main(strategy: Strategy, setup_index: bool = True):
596596
content_understanding_endpoint=os.getenv("AZURE_CONTENTUNDERSTANDING_ENDPOINT"),
597597
)
598598

599-
loop.run_until_complete(main(ingestion_strategy, setup_index=not args.remove and not args.removeall))
600-
loop.close()
599+
try:
600+
loop.run_until_complete(main(ingestion_strategy, setup_index=not args.remove and not args.removeall))
601+
finally:
602+
# Gracefully close any async clients/credentials to avoid noisy destructor warnings
603+
try:
604+
loop.run_until_complete(blob_manager.close_clients())
605+
loop.run_until_complete(openai_client.close())
606+
loop.run_until_complete(azd_credential.close())
607+
except Exception as e:
608+
logger.debug(f"Failed to close async clients cleanly: {e}")
609+
loop.close()

docs/multimodal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ With this feature enabled, the following changes are made:
4444
azd env set AZURE_SEARCH_INDEX multimodal-index
4545
```
4646

47-
Then run the data ingestion process again to re-index the data:
47+
Then delete the `.md5` hash files in the data folder(s) and run the data ingestion process again to re-index the data:
4848

4949
Linux/Mac:
5050

0 commit comments

Comments
 (0)