Skip to content

Pyjoyment: the timeouts of a route, inactivity_timeout and request_timeout, with a 504 after its deadline - #612

Merged
dex4er merged 2 commits into
cancel-actionsfrom
route-timeouts
Nov 12, 2026
Merged

dex4er merged 2 commits into
cancel-actionsfrom
route-timeouts

Conversation

@dex4er

@dex4er dex4er commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

The second step of #266, stacked on #611: the timeouts of a route, as the inactivity timeout of a connection that waits for a model of language, and the most time to the end of a response.

Changes

  • The values inactivity_timeout and request_timeout of the stash of a route, of its defaults or of a route of under before it, are set before its first action: r.post('/chat', {'inactivity_timeout': 600, 'request_timeout': 120}), or for a group, r.under('/llm', {...}). The keyword arguments of a route are the constraints of its placeholders, so the timeouts are values of the stash, as the other special values; both are reserved stash values, with # Unlike Mojolicious:.

  • The helper request_timeout, the deadline of a request, which Mojolicious does not have, with the name of request_timeout of the user agent. When it passes:

    The timer goes with the end of the transaction, and a later call replaces it.

  • Pyjo.Util._suggest: a name that the mistaken one starts with comes before one that starts with it, as req for request of another framework, which the new helper request_timeout would take otherwise; t/Pyjoyment/hints_lite_app.py caught it.

  • Docs: the helper, the reserved stash values of Controller.stash, a paragraph of the routing guide on the timeouts of a route and of a group, and the skill async.

  • Pyjoyment, Pyjo.Promise: async actions and their requests are cancelled when the connection closes #611 gets a fix of its test: then(lambda: client.cancel()) adopted the rejection of the promise that cancel returns, which was reported as an unhandled rejected promise.

Validation

  • t/Pyjoyment/timeouts_lite_app.py on asyncio and Pyjo.Reactor.Poll: the inactivity timeout of the server and the longer one of a route, the deadline of a route, of the helper, of a group, and of an action with a callback, which gets 504, of a stream, whose connection closes without its last chunk, and one that does not pass after a response
  • On the reactors of the distributions: Uvloop, gevent and Twisted, and Trio with Pyjo.Reactor.Trio: run_coroutine returns a function that cancels the task Pyjo-Reactor-Trio#17 and without it, where the assertions of the cancelled actions are skipped
  • The suite on asyncio and on Pyjo.Reactor.Poll with PYTHONDEVMODE=1, without a ResourceWarning or an unhandled rejected promise
  • Sphinx with -W, trunk check

Part of #266

🤖 Generated with Claude Code

dex4er and others added 2 commits November 12, 2026 16:43
…tarts with to one that starts with it

As "req" for "request" of another framework, which the helper
request_timeout, that starts with it and is closer, would take otherwise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…meout of its stash, and the helper request_timeout

The values of the stash of a route, of its defaults or of a route of under
before it, set the inactivity timeout of the connection and the most time to
the end of the response before its first action. When the time of
request_timeout passes, the actions that are coroutine functions are
cancelled where they wait, with the requests of the user agent that they
wait for, and the request gets an empty 504 response, or the connection
closes when the response has started already. Both names are reserved stash
values, which a placeholder cannot have.

Part of #266

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dex4er dex4er added this to the 0.4.0 milestone Nov 12, 2026
@dex4er
dex4er added this pull request to stack #613 November 12, 2026 15:47
@read-the-docs-community

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

Docker Smoke Test

Job Tests Passed ✅ Skipped ⚠️ Failed ❌ Log
smoke (app) 11 11 0 0 ✅ 131298518480
smoke (fastcgi) 5 5 0 0 ✅ 131298517735
smoke (kubernetes) 8 8 0 0 ✅ 131298518145
smoke (lambda) 2 2 0 0 ✅ 131298517925
smoke (lambda-image) 5 5 0 0 ✅ 131298517904
smoke (lambda-stream) 2 2 0 0 ✅ 131298518393
smoke (lambda-zip) 9 9 0 0 ✅ 131298517351
smoke (lite) 4 4 0 0 ✅ 131298518080
smoke (lite-pep723) 4 4 0 0 ✅ 131298518066
All 50 50 0 0 ✅

The run of the workflow

@github-actions

Copy link
Copy Markdown
Contributor

Tests

Job Tests Passed ✅ Skipped ⚠️ Failed ❌ Log
prove (python 3.12, Asyncio) 7459 7430 29 0 ✅ 131298500200
prove (python 3.12, Poll) 7431 7400 31 0 ✅ 131298500266
prove (python 3.13, Asyncio) 7459 7430 29 0 ✅ 131298499893
prove (python 3.13, Poll) 7431 7400 31 0 ✅ 131298500339
prove (python 3.14, Asyncio) 7490 7466 24 0 ✅ 131298500498
prove (python 3.14, Poll) 7462 7436 26 0 ✅ 131298500099
prove (python 3.15, Asyncio) 7490 7466 24 0 ✅ 131298500116
prove (python 3.15, Poll) 7462 7436 26 0 ✅ 131298500311
prove (python 3.15t, Asyncio) 7490 7466 24 0 ✅ 131298500574
prove (python 3.15t, Poll) 7462 7436 26 0 ✅ 131298500685
prove (python mise, Asyncio) 7569 7534 35 0 ✅ 131298500208
prove (python mise, Asyncio, Windows) 7290 7224 66 0 ✅ 131298500142
prove (python mise, Poll) 7541 7504 37 0 ✅ 131298499421
prove (python mise, Poll, Windows) 7262 7194 68 0 ✅ 131298500046
prove (python pypy3.12, Asyncio) 7459 7430 29 0 ✅ 131298500438
prove (python pypy3.12, Poll) 7431 7400 31 0 ✅ 131298500381
pytest (python 3.12, ubuntu-26.04-arm) 441 415 26 0 ✅ 131298499882
pytest (python 3.15, ubuntu-26.04-arm) 441 420 21 0 ✅ 131298500088
pytest (python 3.15, windows-2025) 441 392 49 0 ✅ 131298500014
servers (python 3.12) 54 54 0 0 ✅ 131298499943
servers (python 3.15) 53 53 0 0 ✅ 131298499907
All 120618 119986 632 0 ✅

The run of the workflow

@dex4er
dex4er merged commit 961c204 into main Nov 12, 2026
36 checks passed
@dex4er
dex4er deleted the route-timeouts branch November 12, 2026 16:34
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.

1 participant