fix(search): a search that never reached YouTube gets its slot back, and a busy one waits a bounded time

The slot was kept as soon as search.list was about to be called, so a search refused before it went out (no connection, no token) cost the user a slot for nothing. It is kept now only once the client recorded the call's units, or the request went out and its answer never came (YouTube may have counted it): YouTubeError says whether a transport failure was sent, and the client counts what it spent.

The process lock around the budget check and the call is waited for at most ten seconds; past that the search is refused as busy (search_busy, a retry can help) and gets its slot back, instead of parking a request worker behind every slow call before it. The lock test now pins one hold around both steps, and the busy test fails on a wait without a bound.
This commit is contained in:
2026-10-25 13:51:25 +01:00
parent 84db570951
commit 2e1934689f
6 changed files with 196 additions and 23 deletions
+1
View File
@@ -190,6 +190,7 @@
"registration_closed": "Registration is currently closed",
"related_disabled": "Related videos are turned off on this instance.",
"related_daily_limit": "You've reached today's related videos limit ({{limit}}). Opening a list counts as one request, and so does every “Show more”. Try again tomorrow.",
"search_busy": "Too many searches are running right now. Try again in a few seconds.",
"search_disabled": "Live YouTube search is turned off on this instance.",
"search_daily_limit": "You've reached today's YouTube search limit ({{limit}}). Try again tomorrow.",
"search_term_required": "Enter something to search for",
+1
View File
@@ -190,6 +190,7 @@
"registration_closed": "A regisztráció jelenleg zárva van",
"related_disabled": "A kapcsolódó videók ki vannak kapcsolva ezen a példányon.",
"related_daily_limit": "Elérted a kapcsolódó videók mai korlátját ({{limit}}). Egy lista megnyitása és minden „Mutass többet” egy-egy kérésnek számít. Próbáld holnap.",
"search_busy": "Most túl sok keresés fut egyszerre. Próbáld újra pár másodperc múlva.",
"search_disabled": "Az élő YouTube-keresés ki van kapcsolva ezen a példányon.",
"search_daily_limit": "Elérted a mai YouTube-keresési korlátot ({{limit}}). Próbáld holnap.",
"search_term_required": "Írj be egy keresőkifejezést",