persist SharedFile on change of comments #35

pull/42/head
Zlatin Balevsky 2020-02-18 02:14:32 +00:00
parent c11d81c6c3
commit a505a2449a
2 changed files with 9 additions and 2 deletions

View File

@ -268,6 +268,7 @@ public class Core {
eventBus.register(FileLoadedEvent.class, persisterFolderService)
eventBus.register(FileHashedEvent.class, persisterFolderService)
eventBus.register(FileUnsharedEvent.class, persisterFolderService)
eventBus.register(UICommentEvent.class, persisterFolderService)
log.info("initializing host cache")
File hostStorage = new File(home, "hosts.json")

View File

@ -89,6 +89,10 @@ class PersisterFolderService extends BasePersisterService {
}
}
void onUICommentEvent(UICommentEvent e) {
persistFile(e.sharedFile,null)
}
void load() {
log.fine("Loading...")
Thread.currentThread().setPriority(Thread.MIN_PRIORITY)
@ -144,8 +148,10 @@ class PersisterFolderService extends BasePersisterService {
writer.println json
}
if (ih != null) {
def hashListPath = getHashListPath(sf)
hashListPath.toFile().bytes = ih.hashList
}
log.fine("Time(ms) to write json+hashList: " + (System.currentTimeMillis() - startTime))
} as Runnable)
}