search/db: checkout connection #1131
No reviewers
Labels
No labels
approved, awaiting change
broken setup
bug
cannot reproduce
configuration
documentation
duplicate
enhancement
extremely low priority
feature request
Fix it yourself
help wanted
invalid
mastodon_api
needs change/feedback
needs docs
needs tests
not a bug
not our bug
planned
pleroma_api
privacy
question
static_fe
triage
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
AkkomaGang/akkoma!1131
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "Oneric/akkoma:post-search-db-conn-checkout"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Besides the actual search query we also run a few prep queries. Let’s avoid having to wait for a new db conn each time.
Not sure how much difference this actually makes, but with network bits already excluded it shouldn’t hurt at least.
For user search this doesn’t seem worthwhile (except with
resolve=false) as everything before the final step may perform network fetches and the final step itself has no (obvious) extra prep queries baked in, just the main query itself.8cdd8852237b5a7f8519@ -68,3 +68,3 @@query = String.trim(query)options = search_options(params, user)timeout = Keyword.get(Repo.config(), :timeout, 15_000)timeout = 2 * Keyword.get(Repo.config(), :timeout, 15_000)maybe worth just doubling the default timeout to 30s instead of the configured amount - would seem weird to derive the value from the config instead of taking it verbatim
the value we read here from the config is the timeout for a single db query.
However, here the local
timeoutvalue is used as the deadline for each search task and the user and post search tasks will both execute multiple db queries + some elixir-side processing and possibly even network requests; so the verbatim timeout for a single db query from config imho doesn’t make too much sense here. Nor does raising the default for single queries to better suit a non-db-query use case.Adding a multiplier admittedly also kinda adhoc. A separate timeout config might be ideal in some sense, but then it’s possible to end up with somewhat nonsensical values where the task timeout is shorter than the repo timeout for a single query. But perhaps that’s worth the increased specifity?
Added a new config option specifically for these tasks
And also added a checkout to user search if no network requests are being made at all and updated search docs to be in one place, more comprehensive and properly formatted
1fc689162cf8096e309df8096e309d1630dd38a41630dd38a4435d56248a435d56248a1f214f94f9