mirror of https://github.com/zlatinb/muwire
persist SharedFile on change of comments #35
parent
c11d81c6c3
commit
a505a2449a
|
@ -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")
|
||||
|
|
|
@ -88,6 +88,10 @@ class PersisterFolderService extends BasePersisterService {
|
|||
persistFile(loadedEvent.loadedFile, loadedEvent.infoHash)
|
||||
}
|
||||
}
|
||||
|
||||
void onUICommentEvent(UICommentEvent e) {
|
||||
persistFile(e.sharedFile,null)
|
||||
}
|
||||
|
||||
void load() {
|
||||
log.fine("Loading...")
|
||||
|
@ -144,8 +148,10 @@ class PersisterFolderService extends BasePersisterService {
|
|||
writer.println json
|
||||
}
|
||||
|
||||
def hashListPath = getHashListPath(sf)
|
||||
hashListPath.toFile().bytes = ih.hashList
|
||||
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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue