Activity.Search: fallback on status resolution on DB Timeout

This commit is contained in:
Haelwenn (lanodan) Monnier 2021-08-12 10:29:53 +02:00
parent 7c1243178b
commit 6455b967ec
No known key found for this signature in database
GPG key ID: D5B7A8E43C997DEE
2 changed files with 20 additions and 13 deletions

View file

@ -14,6 +14,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Removed
## Unreleased-patch
- Mastodon API: Activity Search fallbacks on status fetching after a DB Timeout/Error
## 2.4.0 - 2021-08-xx
### Changed

View file

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