You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Fix init of context managers and context handling in BasicCrawler (#714)
### Problems
- The `EventManager` could be initialized multiple times, such as when
running a `Crawler` wrapped inside an `Actor`.
- In `crawler.run`, the async context was entered and exited directly,
which could lead to issues if the caller had already entered it. This
scenario might occur when users provide their own instances of
`BrowserPool`, `SessionPool`, `EventManager`, or others.
### Solution
- Address these issues by introducing an `active` flag to the existing
context managers to prevent multiple initializations.
- Implement an `ensure_context` helper and apply it to methods where
context management is required.
- Fix & improve tests to ensure these cases are covered.
### Others
- I added missing names to asyncio tasks.
0 commit comments