fix(crawlers)!: Do not purge the request queue between `run()` calls by Mantisus · Pull Request #2343 · apify/crawlee-python · GitHub
Skip to content

fix(crawlers)!: Do not purge the request queue between run() calls - #2343

Open
Mantisus wants to merge 3 commits into
apify:v2from
Mantisus:update-purge
Open

Mantisus wants to merge 3 commits into
apify:v2from
Mantisus:update-purge

Conversation

@Mantisus

Copy link
Copy Markdown
Collaborator

Description

A repeated crawler.run() no longer purges the request queue. It continues with the same request manager, so requests that an earlier run handled, failed ones included, aren't crawled again. The purge_request_queue argument of run() is removed, together with the named-queue and failed-run exemptions. JS v4 made the same change (apify/crawlee#4056). To crawl the same requests again, purge the request manager or open a fresh queue.

A run that processes nothing while its request manager holds only handled requests now logs a warning explaining how to crawl them again. Unlike JS, the warning also requires the manager to be finished, so a crawl that abort_on_error stopped with requests still pending doesn't get it.

RequestManagerTandem.purge() now purges the manager it wraps instead of doing nothing. RequestQueue.purge() no longer drops an unnamed queue and opens the default one in its place when the storage client can't purge. The client's NotImplementedError now propagates, so on the Apify platform use drop() or a fresh queue. The upgrade guide has a section for each change.

Issues

@Mantisus Mantisus self-assigned this Oct 20, 2026
@github-actions github-actions Bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Oct 20, 2026
@Mantisus Mantisus changed the title refactor!: stop purging the request queue on repeated run() calls refactor(crawlers)!: stop purging the request queue on repeated run() calls Oct 20, 2026
@Mantisus
Mantisus requested a review from vdusek October 20, 2026 19:10
Comment thread src/crawlee/crawlers/_basic/_basic_crawler.py Outdated
Comment thread src/crawlee/crawlers/_basic/_basic_crawler.py Outdated
Comment thread tests/unit/crawlers/_basic/test_basic_crawler.py Outdated
@vdusek vdusek changed the title refactor(crawlers)!: stop purging the request queue on repeated run() calls fix(crawlers)!: Do not purge the request queue between run() calls Oct 21, 2026

@vdusek vdusek left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (I just changed the PR title to correspond with the JS one)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants