From e0beef9d730d0e59731ffa87e68df40417644e2d Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Wed, 14 Aug 2019 09:23:34 +0100 Subject: [PATCH] [storage-aws] don't create new event listener for every event --- .../scala/net/kemitix/thorp/storage/aws/Uploader.scala | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/storage-aws/src/main/scala/net/kemitix/thorp/storage/aws/Uploader.scala b/storage-aws/src/main/scala/net/kemitix/thorp/storage/aws/Uploader.scala index b871bbb..b14427f 100644 --- a/storage-aws/src/main/scala/net/kemitix/thorp/storage/aws/Uploader.scala +++ b/storage-aws/src/main/scala/net/kemitix/thorp/storage/aws/Uploader.scala @@ -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 => {