Skip to content

Python: Patch workers.wait_until as well as ctx.waitUntil - #7293

Merged
hoodmane merged 2 commits into
mainfrom
hoodmane/patch-workers-waitUntil
Sep 10, 2026
Merged

Python: Patch workers.wait_until as well as ctx.waitUntil#7293
hoodmane merged 2 commits into
mainfrom
hoodmane/patch-workers-waitUntil

Conversation

@hoodmane

@hoodmane hoodmane commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

We've been patching ctx.waitUntil() so that when it is passed a Python awaitable it will keep it alive until it resolves. We forgot to patch workers.wait_until() in the same way. This fixes the problem.

Thanks to @audreyfeldroy for reporting this in cloudflare/workers-py#249.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

The generated output of @cloudflare/workers-types matches the snapshot in types/generated-snapshot 🎉

@hoodmane
hoodmane force-pushed the hoodmane/patch-workers-waitUntil branch from a86e182 to 0fc5660 Compare September 9, 2026 17:36
@ask-bonk

This comment was marked as resolved.

@ask-bonk

ask-bonk Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

I'm Bonk, and I've done a quick review of your PR.

Patches module-level Python waitUntil() awaitable lifetime handling.

  1. P2: Rejected awaitables leak copied PyProxies; posted a suggestion comment.

github run

@ryanking13 ryanking13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! In the future, I would like to move these kinds of wrappers into workers-py, but for now looks good.

Comment thread src/workerd/server/tests/python/python-rpc/worker.py
@hoodmane
hoodmane force-pushed the hoodmane/patch-workers-waitUntil branch from e00d7ca to 21abee7 Compare September 10, 2026 05:13
We've been patching `ctx.waitUntil()` so that when it is passed a Python
awaitable it will keep it alive until it resolves. We forgot to patch
`workers.wait_until()` in the same way. This fixes the problem.

Thanks to audreyfeldroy for reporting this in cloudflare/workers-py # 249.
@hoodmane
hoodmane force-pushed the hoodmane/patch-workers-waitUntil branch from 21abee7 to e23e55d Compare September 10, 2026 18:48
@hoodmane
hoodmane merged commit 6a5e11b into main Sep 10, 2026
22 of 23 checks passed
@hoodmane
hoodmane deleted the hoodmane/patch-workers-waitUntil branch September 10, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants