Skip to content

fix!: Cancel right away on a zero listener or add-requests timeout - #2465

Open
Mantisus wants to merge 2 commits into
apify:v2from
Mantisus:zero-timeout
Open

Mantisus wants to merge 2 commits into
apify:v2from
Mantisus:zero-timeout

Conversation

@Mantisus

Copy link
Copy Markdown
Collaborator

Description

A zero close_timeout of an event manager, or a zero timeout passed to EventManager.wait_for_all_listeners_to_complete(), now cancels the running event listeners right away. A zero wait_for_all_requests_to_be_added_timeout in add_requests() does the same for the requests still being added.

A zero timeout used to wait without a limit. To wait without a limit, pass None.

Testing

  • Unit test that a zero timeout cancels an unfinished task without waiting for it.

✍️ Drafted by Claude Code

@Mantisus Mantisus self-assigned this Nov 17, 2026
@github-actions github-actions Bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Nov 17, 2026
@Mantisus
Mantisus requested a review from vdusek November 17, 2026 22:42
@vdusek vdusek changed the title fix!: Cancel right away on a zero timeout for event listeners and added requests fix!: Cancel right away on a zero listener or add-requests timeout Nov 18, 2026
return

timeout_secs = timeout.total_seconds() if timeout else None
timeout_secs = timeout.total_seconds() if timeout is not None else None

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.

Suggestion: Now that zero and None mean different things, the public docstrings should say it: None waits without a limit, zero cancels right away. Only the upgrading guide says it now. The docstrings are close_timeout and wait_for_all_listeners_to_complete(timeout=...) in events/_event_manager.py, and wait_for_all_requests_to_be_added_timeout in request_loaders/_request_manager.py and BasicCrawler.add_requests.

✍️ Drafted by Claude Code

Comment thread docs/06_upgrading/upgrading_to_v2.md Resolved
@Mantisus
Mantisus requested a review from vdusek November 18, 2026 13:24

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.

2 participants