-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(backend): fallback if sinceId
is older than the oldest in cache when using FTT
#14061
Merged
syuilo
merged 3 commits into
misskey-dev:develop
from
zyoshoka:fallback-if-sinceid-is-older-than-the-oldest-in-cache-when-using-ftt
Jun 22, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useDbFallback
がfalseのときはps.sinceId != null && ps.sinceId < oldestNoteId
の条件でdbfallbackにならないほうがいいかもしれない?情報がないよりはあったほうがマシかは考える余地はあるけど。(#13495 の実装参照)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L59のps.useDbFallbackのチェックでDBフォールバックしないようになっているので問題ないと思います
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fallbackしようとしてfallbackから取得できないと、FTTから欠けながら取得できるはずのデータが取得できないのがあまり良くない可能性があるっという意味です
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
あーなるほど(たしかに)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(別 issue で議論したほうがいいかもしれませんが)
enableFanoutTimelineDbFallback
オプション自体の有用性があまりない気が薄々しています。仮にオフにしていたとしてもchannels/timeline
やusers/notes
ではその値は使われず必ずフォールバックされますし、その他のエンドポイントでもuntilId
付きの絞り込みとかでlimit
を満たす量のノートがキャッシュになかった場合にはこの部分:misskey/packages/backend/src/core/FanoutTimelineEndpointService.ts
Line 135 in 0d76842
で結局フォールバックされるようになっていて、どの場合なら必ずフォールバックしてどの場合ならenableFanoutTimelineDbFallback
を尊重するかの基準が微妙になっています。この仕様に追従するなら、このケースでも新しいノート返したり空配列を返したりするよりは、強制的にフォールバックするほうが自然なのかな…と思います。There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
それは
sinceId
の話で、untilId
の場合は空配列になっていると思います(未検証)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
untilIdはそうですね。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
あー語弊があったかと思うので補足すると、
sinceId
のときだけ新しいノートを返すのも変なので空配列が返ってくる仕様に統一するのが合理的なんじゃないかという意味でしたThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
あー、そういうことか。たしかにどっちも正しいのはそうですが本当に条件に合致するものがない(untilId以前はない)のとあるけどかけてるかもしれない(sinceId以降は穴があるかもだけど情報がある)なので帰ったほうが嬉しいことはあると思います
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
まあ折角キャッシュにあるのに返してくれないのが微妙なのは確かですね。とはいえその場合には「正しく取得できなかった可能性がある」といった旨の表示をフロント側でしたほうが親切かなと思います