Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skeleton implementation of closed-loop unsaved detection (#56).
Periodically creates new Firepad.Headless, loads the text and compares to current editor content. Also checks Firebase's online status for better messages. After a couple days of torturing, this seems to reliably detect #85 borked firepad state and warn "Online but unsaved — BUG?". Problems: - False positives during typing (saw this) or incoming changes (theoretical). Needs debouncing after a period of quiet... - Currently for easy testing runs the check *every second*! Should increase testSyncIntervalMs to 30-60sec before landing. - If only to avoid constant 1-5% CPU usage. - Performance concerns: after a day of holding and torture-editing 2 chrome tabs, things crawled to unusably slow stuck-after-every-press. Their combined memory usage grew to ~1.5GB! (plus ~1GB for their dev tools) And at some point CPU usage grew to 100%. - Near the end, I timed Headless getText to take >3 seconds! Initially it's ~1ms for existing Headless and ~230ms for new Headless! This explains 100% CPU - 1sec timer should be after prev timer finished execution, but alas getText() returns immediately. - AFAICT, snapshots were being taken so it's not op composition overhead. - It seems memory leak does not happen in current mathdown.net version (0f69d29).
- Loading branch information