mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
AutoSave: Delay I/O until after the pageturn (#6917)
nextTick was too early ;). Prevents small hitches when turning the page for the page where this triggers. Apply the same trickery to the Stats DB insert, even if that one probably had a much smaller impact.
This commit is contained in:
@@ -967,10 +967,12 @@ function ReaderView:checkAutoSaveSettings()
|
||||
if not interval then -- no auto save
|
||||
return
|
||||
end
|
||||
|
||||
local now_ts = os.time()
|
||||
if now_ts - self.settings_last_save_ts >= interval*60 then
|
||||
self.settings_last_save_ts = now_ts
|
||||
UIManager:nextTick(function()
|
||||
-- I/O, delay until after the pageturn
|
||||
UIManager:tickAfterNext(function()
|
||||
self.ui:saveSettings()
|
||||
end)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user