fix(reader): save reading progress with 0.5s debounce on page change - #368
Merged
deepin-bot[bot] merged 1 commit intoSep 7, 2026
Conversation
Page changes only updated m_operation.currentPage in memory; progress was persisted only on bookmark/annotation ops, every 30s auto-save or clean close, so killall lost the last page position while bookmarks survived. Start a single-shot debounce timer (500ms, restarted on each page change so bursts coalesce) that calls saveProgressToDb(); the database runs in WAL with synchronous=FULL, so the save survives abnormal termination. 页面切换仅在内存更新当前页,阅读进度此前只在书签/注释操作、30秒自动 保存、正常关闭时落盘,killall 杀进程会丢失最新进度而书签已保存。 新增 0.5 秒防抖定时器(每次页面切换重启计时,连续变化自动合并), 超时后经 saveProgressToDb() 落盘;数据库为 WAL+synchronous=FULL, 异常退出后进度不丢。 Log: 页面切换后防抖保存阅读进度,异常退出进度不丢 PMS: BUG-375997 Influence: 翻页后 0.5 秒自动落盘阅读进度,killall 等异常退出进度可恢复;正常关闭流程行为不变。
Reviewer's GuideReading progress is now persisted 500 ms after the latest page change via a single-shot debounce timer, reducing the window in which abnormal termination can lose the current page while preserving existing auto-save and clean-close behavior. Sequence diagram for debounced reading progress persistencesequenceDiagram
participant Reader as Reader UI
participant DocSheet
participant Timer as m_progressSaveTimer
participant DB as Progress database
Reader->>DocSheet: onBrowserPageChanged(page)
DocSheet->>DocSheet: update m_operation.currentPage
DocSheet->>Timer: start()
Note over Timer: Single-shot 500 ms timer
opt another page change before timeout
Reader->>DocSheet: onBrowserPageChanged(page)
DocSheet->>Timer: start()
end
Timer->>DocSheet: saveProgressToDb()
DocSheet->>DB: persist current reading progress
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
lzwind
approved these changes
Sep 7, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: add-uos, lzwind The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 无 2. 代码质量 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 无 3. 代码性能 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 无 4. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: 无 💡 改进建议代码示例// 代码实现良好,无需修改本报告由 AI 代码审查工具自动生成 |
Contributor
Author
|
/merge |
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.
Page changes only updated m_operation.currentPage in memory; progress was persisted only on bookmark/annotation ops, every 30s auto-save or clean close, so killall lost the last page position while bookmarks survived. Start a single-shot debounce timer (500ms, restarted on each page change so bursts coalesce) that calls saveProgressToDb(); the database runs in WAL with synchronous=FULL, so the save survives abnormal termination.
页面切换仅在内存更新当前页,阅读进度此前只在书签/注释操作、30秒自动
保存、正常关闭时落盘,killall 杀进程会丢失最新进度而书签已保存。
新增 0.5 秒防抖定时器(每次页面切换重启计时,连续变化自动合并),
超时后经 saveProgressToDb() 落盘;数据库为 WAL+synchronous=FULL, 异常退出后进度不丢。
Log: 页面切换后防抖保存阅读进度,异常退出进度不丢
PMS: BUG-375997
Influence: 翻页后 0.5 秒自动落盘阅读进度,killall 等异常退出进度可恢复;正常关闭流程行为不变。
Summary by Sourcery
Persist reading progress after page changes to prevent the latest position from being lost on abnormal exit.
Bug Fixes:
Enhancements: