Skip to content

Commit fd6663f

Browse files
authored
fix: fix event migrating handler in RequestQueue (#825)
### Description - fix event migrating handler and `is_finished` method in `RequestQueue` ### Issues - Closes: #815
1 parent dcb1322 commit fd6663f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/crawlee/storages/_request_queue.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ def __init__(self, id: str, name: str | None, storage_client: BaseStorageClient)
119119
self._queue_paused_for_migration = False
120120

121121
event_manager.on(event=Event.MIGRATING, listener=lambda _: setattr(self, '_queue_paused_for_migration', True))
122-
event_manager.on(event=Event.MIGRATING, listener=lambda _: self._clear_possible_locks())
123-
event_manager.on(event=Event.ABORTING, listener=lambda _: self._clear_possible_locks())
122+
event_manager.on(event=Event.MIGRATING, listener=self._clear_possible_locks)
123+
event_manager.on(event=Event.ABORTING, listener=self._clear_possible_locks)
124124

125125
# Other internal attributes
126126
self._tasks = list[asyncio.Task]()
@@ -494,7 +494,7 @@ async def is_finished(self) -> bool:
494494
'Queue head still returned requests that need to be processed (or that are locked by other clients)',
495495
)
496496

497-
return not current_head.items and not self._in_progress
497+
return (not current_head.items and not self._in_progress) or self._queue_paused_for_migration
498498

499499
async def get_info(self) -> RequestQueueMetadata | None:
500500
"""Get an object containing general information about the request queue."""

0 commit comments

Comments
 (0)