mirror of
https://github.com/bookorbit/bookorbit.git
synced 2026-11-03 00:11:37 -06:00
fix(reader): discard unmatched lifecycle entries
Treat an unmatched lifecycle response as terminal so built-in help documents do not retry until parked. Record the skipped title in sync activity and clear the stale parked warning. Closes #1886
This commit is contained in:
@@ -20,6 +20,7 @@ local SUCCESS_TEXT = {
|
||||
progress_push = function() return _("Sent reading progress") end,
|
||||
progress_pull = function() return _("Pulled reading progress") end,
|
||||
connection_test = function() return _("Connection test passed") end,
|
||||
lifecycle_unmatched = function() return _("Skipped a book not in BookOrbit") end,
|
||||
}
|
||||
|
||||
local ERROR_TEXT = {
|
||||
|
||||
@@ -474,9 +474,20 @@ function BookOrbit:requestLifecycleOutboxDrain(source, interactive)
|
||||
if finished then return end
|
||||
finished = true
|
||||
local latest = outbox:readLatest(started.id)
|
||||
local complete = outbox:isComplete(latest)
|
||||
local unmatched = err == "unmatched"
|
||||
local complete = unmatched or outbox:isComplete(latest)
|
||||
if complete then
|
||||
outbox:removeEntry(started.id)
|
||||
if unmatched then
|
||||
local last_error = self.settings.last_error
|
||||
if last_error and last_error.event == "lifecycle_outbox"
|
||||
and last_error.code == "outbox_blocked" then
|
||||
self.settings.last_error = nil
|
||||
end
|
||||
BookOrbitActivity.recordSuccess(
|
||||
self.settings, "lifecycle_unmatched", snap.title)
|
||||
G_reader_settings:flush()
|
||||
end
|
||||
else
|
||||
outbox:markFinished(started.id)
|
||||
self:scheduleLifecycleOutboxRetry()
|
||||
@@ -494,7 +505,7 @@ function BookOrbit:requestLifecycleOutboxDrain(source, interactive)
|
||||
end
|
||||
end
|
||||
done()
|
||||
if complete and not err then
|
||||
if complete and (not err or unmatched) then
|
||||
self:requestLifecycleOutboxDrain("recovery")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user