Cut sync delay: settable 30–60s interval, and sync when agents check for changes #115
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jfro/rm-analyzer#115
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Marked-up review pages take a long time to reach agents (Fortysix listeners included). Most of that wait is rm-analyzer's scheduled sync:
sync_interval: :timer.minutes(15)inconfig/config.exs, with no override inruntime.exs.A sync that finds nothing new is already cheap. It makes one
GET /sync/v4/rootand stops ifroot.hash == account.root_hash(lib/rm_analyzer/remarkable/sync.ex:54). So checking far more often costs almost nothing.1. Shorter, settable interval
sync_intervalto 60s (or 30s).runtime.exs, e.g.RM_SYNC_INTERVALin seconds, where 0 or empty turns the scheduled sync off.2. Sync when an agent asks for changes
list_changesis called, orrm-analyzer://changesis read or subscribed to, callSyncServer.sync_soon/1for the key's user if their last sync is more than about 30s old.notifications/resources/updatedpush to subscribers already fires once a sync records changes, so no change is needed there.Not included: reMarkable's cloud notifications websocket (instant push). It's unofficial and more work, and can be revisited if 1 and 2 aren't enough.
Done when: an edit the tablet has uploaded shows up in
list_changes(and as a resource update) within about a minute with nothing triggering it, and within a few seconds when an agent is checking. Tests cover the env override and the stale-sync trigger with its debounce.