Skip to content

Commit 6dce5e9

Browse files
committed
fix: use async Modal interfaces to eliminate blocking warnings in webhook handler
Replace blocking modal.Sandbox.create() and sandbox.set_tags() with their async equivalents (.aio()) in the async github_webhook handler. Eliminates AsyncUsageWarning from Modal runtime logs.
1 parent 26829e0 commit 6dce5e9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,14 +763,14 @@ async def github_webhook(request: Request):
763763
sandbox_kwargs["region"] = MODAL_REGION
764764

765765
spawn_start = time.monotonic()
766-
sandbox = modal.Sandbox.create(
766+
sandbox = await modal.Sandbox.create.aio(
767767
"bash",
768768
"-c",
769769
cmd,
770770
**sandbox_kwargs,
771771
)
772772

773-
sandbox.set_tags({"job_id": str(job_id)})
773+
await sandbox.set_tags.aio({"job_id": str(job_id)})
774774
spawn_duration = time.monotonic() - spawn_start
775775

776776
logger.info(

0 commit comments

Comments
 (0)