Repository navigation
db.execute(custom_time_limit=...) can now exceed sql_time_limit_ms - #3106
Merged
Merged
Conversation
db.execute(custom_time_limit=) previously ignored any value higher than the sql_time_limit_ms setting. Internal and plugin code can now use it to run a query with a longer limit. The ?_timelimit= query string argument is now capped in the table and query views, so it can still only shorten the limit. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016Bvfq9gKFvZ3ohFmtddE8s
Facet, facet suggestion, table count, autocomplete and foreign key suggestion queries pass their own shorter limits to db.execute(). Those are capped at sql_time_limit_ms again, using a new datasette.capped_time_limit_ms() helper shared with ?_timelimit=. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016Bvfq9gKFvZ3ohFmtddE8s
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3106 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 81 81
Lines 14577 14585 +8
=====================================
- Misses 14577 14585 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
simonw
added a commit
that referenced
this pull request
Nov 22, 2026
simonw
added a commit
that referenced
this pull request
Nov 23, 2026
Refs #1048, #1342, #1479, #1553, #1611, #1627, #1630, #1671, #1674, #1822, #1841, #1873, #1914, #1919, #1973, #2045, #2073, #2145, #2253, #2356, #2419, #2713, #2805, #2807, #2810, #2826, #2942, #2967, #3070, #3074, #3075, #3078, #3079, #3081, #3082, #3083, #3084, #3085, #3087, #3088, #3089, #3090, #3091, #3092, #3093, #3097, #3098, #3099, #3100, #3101, #3102, #3103, #3104, #3105, #3106, #3107, #3108, #3109, #3111, #3112, #3113, #3115
This was referenced Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
db.execute(custom_time_limit=...)previously ignored any value higher than thesql_time_limit_mssetting, so internal code and plugins had no way to run a query with a longer limit. It now uses the value it is given, shorter or longer.Claude Fable 5.2 Medium
Everything that relied on the old cap keeps it:
?_timelimit=on the query and table views can still only shorten the limit.facet_time_limit_msandfacet_suggest_time_limit_msare still capped bysql_time_limit_ms.These all go through a new
datasette.capped_time_limit_ms(ms)helper, which returnsmin(ms, sql_time_limit_ms). Nothing in core passes a longer limit yet.A timeout is still only treated as "expected" (not a span error) when the custom limit is shorter than the setting.
Things to note
capped_time_limit_ms()is not documented ininternals.rst.Facetgainstime_limit_msandsuggest_time_limit_msproperties. PluginFacetsubclasses that passself.ds.setting("facet_time_limit_ms")straight toexecute()are no longer capped unless they switch to those properties.Tests
custom_time_limitlonger than the setting lets a slow query finish.?_timelimit=5000stays capped on both views, and?_timelimit=5still shortens.sql_time_limit_msis lower than them.custom_time_limitwas ignored is replaced by one asserting it is applied.Docs updated:
internals.rst,json_api.rst,settings.rstand the changelog.Generated by Claude Code