mirror of
https://github.com/bookorbit/bookorbit.git
synced 2026-11-03 08:21:39 -06:00
edc2a2ccfc
Lifecycle handlers previously blocked on network work, so closing or suspending a book stalled the device on slow or offline links. Persist snapshots first and drain them through a lifecycle outbox with connected-state gates and phase-aware retries, so the UI stays responsive and pending work survives restarts. Move persistence behind a state manager with atomic flushes, and chunk sweeps, bulk downloads, and annotation exchange through a background queue with checkpoints and transfer policies, so large libraries make progress incrementally instead of restarting from scratch after an interruption. Server side, add bulk manifest and page stats endpoints with batched queries and catalog query filtering so the plugin can reconcile many books per round trip rather than one request per book.
18 lines
549 B
Lua
18 lines
549 B
Lua
package.path = "koreader-plugin/spec/?.lua;" .. package.path
|
|
|
|
local FakeScheduler = require("helpers/fake_scheduler")
|
|
|
|
local scheduler = FakeScheduler.new()
|
|
local calls = {}
|
|
scheduler:scheduleIn(2, function() table.insert(calls, "later") end)
|
|
scheduler:nextTick(function() table.insert(calls, "next") end)
|
|
assert(scheduler:pendingCount() == 2)
|
|
scheduler:advance(0)
|
|
assert(calls[1] == "next")
|
|
assert(scheduler:pendingCount() == 1)
|
|
scheduler:drain()
|
|
assert(calls[2] == "later")
|
|
assert(scheduler.now == 2)
|
|
|
|
print("bookorbit_test_harness_test.lua: ok")
|