Experimentally only process entries when they change in NAT

This commit is contained in:
2022-12-18 04:45:25 +00:00
parent f04827c346
commit 132a61fc56
3 changed files with 22 additions and 19 deletions

View File

@@ -35,14 +35,26 @@
(File.saveContent (joinPath archiveDir "playgrounds.json") (haxe.Json.stringify playgrounds "\t"))) (File.saveContent (joinPath archiveDir "playgrounds.json") (haxe.Json.stringify playgrounds "\t")))
(method addSystem [:System system] (method addSystem [:System system]
// Assign entries to the Systems that care about them
(doFor =>id entry entries
(system.checkEntryInOrOut this entry))
(systems.push system) (systems.push system)
system) system)
(method addAndProcessSystem [:System system &opt :ArchiveUI ui]
(addSystem system)
(refreshSystem system)
(system.process this ui)
system)
(method refreshSystem [:System system]
(doFor =>id e entries
(system.checkEntryInOrOut this e)))
(method forceProcessAll [&opt :ArchiveUI ui]
(doFor system systems (refreshSystem system))
(processSystems))
(method processSystems [&opt :ArchiveUI ui] (method processSystems [&opt :ArchiveUI ui]
(doFor system systems (system.process this ui))) (doFor system systems
(system.process this ui)))
(prop &mut :Entry->Dynamic defaultInitializer null) (prop &mut :Entry->Dynamic defaultInitializer null)

View File

@@ -153,7 +153,10 @@
(when lastChangeSet (when lastChangeSet
(doFor e lastChangeSet (doFor e lastChangeSet
(assert (and e (isEntry e)) "Lib function forgot to return the Entry that was modified")) (assert (and e (isEntry e)) "Lib function forgot to return the Entry that was modified"))
(doFor e lastChangeSet
(archive.refreshEntry e))
(ui.handleChanges archive lastChangeSet) (ui.handleChanges archive lastChangeSet)
(archive.processSystems)
(when doAfter (doAfter)))))] (when doAfter (doAfter)))))]
// To facilitate asynchronous arg input via UI, we need to construct an insanely complicated nested callback to give the UI // To facilitate asynchronous arg input via UI, we need to construct an insanely complicated nested callback to give the UI
(doFor arg (reverse command.args) (doFor arg (reverse command.args)
@@ -205,11 +208,11 @@
(set ui.controller this) (set ui.controller this)
// Add systems! // Add systems!
(archive.addSystem nameSystem) (archive.addAndProcessSystem nameSystem ui)
(archive.addSystem (new RemarkableAPISystem)) (archive.addSystem (new RemarkableAPISystem))
(archive.addSystem (new WikipediaImageSystem)) (archive.addSystem (new WikipediaImageSystem))
(archive.addSystem (new ImageAttachmentSystem)) (archive.addSystem (new ImageAttachmentSystem))
(archive.addSystem (new KeyShortcutSystem this)) (archive.addAndProcessSystem (new KeyShortcutSystem this) ui)
(archive.addSystem (new DLSystem)) (archive.addSystem (new DLSystem))
(archive.addSystem (new AutoStepperSystem)) (archive.addSystem (new AutoStepperSystem))
(archive.addSystem (new ColorSystem)) (archive.addSystem (new ColorSystem))
@@ -234,15 +237,9 @@
(whenLet [ps (ui.playgroundSystem)] (whenLet [ps (ui.playgroundSystem)]
(set playgroundSystem ps) (set playgroundSystem ps)
(archive.addSystem ps)
(set ps.setupProcess true) (set ps.setupProcess true)
(ps.process archive ui) (archive.addAndProcessSystem ps)
(ps.switchPlaygroundKey (dictGet archive.playgrounds "default"))) (ps.switchPlaygroundKey (dictGet archive.playgrounds "default")))
// Just for testing:
// (archive.addSystem (new AttachmentSystem ["jpg" "jpeg" "png"] ->[archive e files] ~files))
(archive.processSystems ui)
(defCommand Help [] (defCommand Help []
(ui.displayMessage (ui.displayMessage

View File

@@ -184,12 +184,6 @@
(var SCROLL_BOUND_MARGIN 2000) (var SCROLL_BOUND_MARGIN 2000)
(method handleChanges [:Archive archive :ChangeSet changeSet] (method handleChanges [:Archive archive :ChangeSet changeSet]
(when changeSet
// process the WikipediaImageSystem and run spriteSystem process on newly created entries that get one
(archive.processSystems this)
// Do a second loop through the systems, so Playground systems that trigger Core systems have their effects processed
(archive.processSystems this))
(doFor e changeSet (doFor e changeSet
// Entries whose data changed to remove them from the sprite pool will already have been removed // Entries whose data changed to remove them from the sprite pool will already have been removed
// by refreshEntry() // by refreshEntry()