Skip to content

Commit 37f6473

Browse files
committed
Add _crawler_state_rec_task to other context managers
1 parent 675dadf commit 37f6473

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/crawlee/crawlers/_basic/_basic_crawler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,7 @@ async def _run_crawler(self) -> None:
731731
self._statistics,
732732
self._session_pool if self._use_session_pool else None,
733733
self._http_client,
734+
self._crawler_state_rec_task,
734735
*self._additional_context_managers,
735736
)
736737
if cm and getattr(cm, 'active', False) is False
@@ -740,8 +741,7 @@ async def _run_crawler(self) -> None:
740741
for context in contexts_to_enter:
741742
await exit_stack.enter_async_context(context) # type: ignore[arg-type]
742743

743-
async with self._crawler_state_rec_task:
744-
await self._autoscaled_pool.run()
744+
await self._autoscaled_pool.run()
745745

746746
# Emit PERSIST_STATE event when crawler is finishing to allow listeners to persist their state if needed
747747
event_manager.emit(event=Event.PERSIST_STATE, event_data=EventPersistStateData(is_migrating=False))

0 commit comments

Comments
 (0)