[storage-aws] don't create new event listener for every event

This commit is contained in:
Paul Campbell 2019-08-14 09:23:34 +01:00
parent c646ae82fa
commit e0beef9d73

View file

@ -74,9 +74,10 @@ trait Uploader {
: UploadEventListener.Settings => ProgressListener =
listenerSettings =>
new ProgressListener {
override def progressChanged(progressEvent: ProgressEvent): Unit =
UploadEventListener.listener(listenerSettings)(
eventHandler(progressEvent))
private val listener = UploadEventListener.listener(listenerSettings)
override def progressChanged(progressEvent: ProgressEvent): Unit = {
listener(eventHandler(progressEvent))
}
private def eventHandler: ProgressEvent => UploadEvent =
progressEvent => {