fix: await dispatcher stream cleanup#2084
Conversation
|
Nice fix, and thanks for routing the regression test through the public One small suggestion: since this project targets from contextlib import aclosing
async def result_transformer():
try:
async with aclosing(
dispatcher.run_urls_stream(crawler=self, urls=urls, config=config)
) as dispatcher_stream:
async for task_result in dispatcher_stream:
yield transform_result(task_result)
finally:
# Auto-release session only after dispatcher cleanup has completed
await maybe_release_session()
|
Summary
Fixes #2083
Explicitly closes the inner dispatcher stream when a caller closes the public arun_many stream, ensuring dispatcher tasks and queue state are cleaned up before proxy-session release.
List of files changed and why
How Has This Been Tested?
Checklist: