fix: コンテンツ減少時の無限ページングを防止 - #117
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. Walkthrough
Changesページング終了条件
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The pagination update bounds requests when content is removed during retrieval, and the added tests cover stopping after the empty page. No actionable merge risk remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@dc7290 |
概要
getAllContents()とgetAllContentIds()の終了条件を、取得済み件数ではなく初回のtotalCountに対するoffsetで判定するよう変更影響
取得中にコンテンツが増えた場合
初回の件数取得で
totalCount: 101が返り、1ページ目の取得後にコンテンツが200件へ増えた場合を例とします。limit=0でtotalCount: 101を取得limit=100&offset=0で100件を取得limit=100&offset=100で100件を取得offsetが200となり、200 < 101を満たさないため終了この場合、戻り値は最大200件になります。変更前も、取得済み件数が200件となり
200 < 101を満たさないため同じ位置で終了します。取得開始後に追加されたコンテンツをすべて追跡することは、変更前・変更後ともに保証しません。取得中にコンテンツが減った場合
初回の件数取得で
totalCount: 101が返り、1ページ目の取得後に残りの1件が削除または非公開化された場合を例とします。limit=0でtotalCount: 101を取得limit=100&offset=0で100件を取得limit=100&offset=100は0件を返すoffsetが200となり、200 < 101を満たさないため終了この場合、戻り値は100件になります。変更前は取得済み件数を終了条件としていたため、
100 < 101が常に成立し、offset=200,300, ... と空ページへのリクエストが続く可能性がありました。変更後はoffset=200のリクエストを送信せず終了します。取得中の追加・削除・並び順変更による重複や取りこぼしの可能性は従来と同じです。本変更はスナップショット一貫性を保証するものではなく、リクエスト回数を有限にするものです。
リリース予定
無限リクエストが発生する懸念があるため、本PRのマージ後、パッチバージョン
v3.5.1としてリリース予定です。確認
npm test -- --runInBandnpm run lintnpm run formatnpm run typechecknpm run buildCloses #116