Repository navigation
fix(android, desktop): group history keeps loading at the top - #64
Merged
Merged
Conversation
Two things stopped older pages in groups: - Every page of history first asked the server for all unknown authors of the chat's loaded messages, up to 100 at a time. An author the server does not return (a deleted account) stayed unknown and was asked again with every page: an extra request before each page in a group, enough to run into too.many.requests. Each unknown author is now asked once; a chunk that failed goes back to the queue (UserRequests). - After three failed older pages the feed waited for scrolling, but at the very top there is nothing to scroll: loading stopped until the reader scrolled down and back. After the three quick retries it now keeps asking once a minute while the chat is open, and shows the error once per failure streak instead of with every retry.
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.
Проблема
На ПК (Windows) в группах лента не листается высоко: старые сообщения перестают подгружаться у верха.
Две причины в общем коде Android и ПК (
maxly-shared):CoreMessageRepository.resolveSendersперед каждой страницей истории спрашивал у сервера всех неизвестных авторов загруженных сообщений чата, до 100 за раз. Автор, которого сервер не возвращает (удалённый аккаунт), так и оставался неизвестным и спрашивался снова с каждой страницей. В группе это лишний запрос перед каждой страницей, и он может довести сервер доtoo.many.requests.ChatViewModel.loadOlderпосле трёх неудачных попыток ждал прокрутки. Но у самого верха прокручивать некуда: подгрузка вставала, пока не отлистать вниз и обратно.Исправление
UserRequests, как в списке чатов). Порция с ошибкой возвращается в очередь и спросится со следующей страницей.OLDER_SLOW_RETRY_MS). Ошибку показываем один раз за серию отказов, а не с каждым повтором.ChatViewModelTest.olderPageKeepsRetryingSlowlyAtTheTop.Не проверено
Локально не собиралось. Причина выведена из кода: журнал с устройства я не смотрел. Если лента всё равно встанет, нужен журнал диагностики: события
history.pageиhistory.boundaryпокажут, что ответил сервер у верха.Проверить на ПК: открыть большую группу и листать вверх до начала или хотя бы на несколько сотен сообщений.