Set FileLoadedEvent::source in the subclass

Setting it in the super class means we don't set the right value for every case
This commit is contained in:
2020-01-25 15:00:48 +01:00
parent 2935ee1a1d
commit 56da9a16b0
2 changed files with 3 additions and 2 deletions

View File

@@ -53,7 +53,7 @@ abstract class BasePersisterService extends Service{
Set<Destination> sourceSet = sources.stream().map({ d -> new Destination(d.toString())}).collect Collectors.toSet()
DownloadedFile df = new DownloadedFile(file, ih, pieceSize, sourceSet)
df.setComment(json.comment)
return new FileLoadedEvent(loadedFile : df, source : "PersisterService")
return new FileLoadedEvent(loadedFile : df)
}
@@ -71,7 +71,7 @@ abstract class BasePersisterService extends Service{
sf.hit(searcher, timestamp, query)
}
}
return new FileLoadedEvent(loadedFile: sf, source : "PersisterService")
return new FileLoadedEvent(loadedFile: sf)
}

View File

@@ -49,6 +49,7 @@ class PersisterService extends BasePersisterService {
def event = fromJson parsed
if (event != null) {
log.fine("loaded file $event.loadedFile.file")
event.source = "PersisterService"
listener.publish event
loaded++
if (loaded % 10 == 0)