Activity.Search: fallback on status resolution on DB Timeout

Backport of: https://git.pleroma.social/pleroma/pleroma/-/merge_requests/3507
This commit is contained in:
Haelwenn (lanodan) Monnier 2021-08-12 10:29:53 +02:00
parent e117551169
commit 27e1e4c742
No known key found for this signature in database
GPG Key ID: D5B7A8E43C997DEE
2 changed files with 18 additions and 13 deletions

View File

@ -22,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- TwitterAPI: Make `change_password` and `change_email` require params on body instead of query - TwitterAPI: Make `change_password` and `change_email` require params on body instead of query
- Subscription(Bell) Notifications: Don't create from Pipeline Ingested replies - Subscription(Bell) Notifications: Don't create from Pipeline Ingested replies
- AdminAPI: Fix rendering reports containing a `nil` object - AdminAPI: Fix rendering reports containing a `nil` object
- Mastodon API: Activity Search fallbacks on status fetching after a DB Timeout/Error
## 2.4.0 - 2021-08-08 ## 2.4.0 - 2021-08-08

View File

@ -26,6 +26,7 @@ defmodule Pleroma.Activity.Search do
:plain :plain
end end
try do
Activity Activity
|> Activity.with_preloaded_object() |> Activity.with_preloaded_object()
|> Activity.restrict_deactivated_users() |> Activity.restrict_deactivated_users()
@ -39,6 +40,9 @@ defmodule Pleroma.Activity.Search do
:offset :offset
) )
|> maybe_fetch(user, search_query) |> maybe_fetch(user, search_query)
rescue
_ -> maybe_fetch([], user, search_query)
end
end end
def maybe_restrict_author(query, %User{} = author) do def maybe_restrict_author(query, %User{} = author) do