[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 = : UploadEventListener.Settings => ProgressListener =
listenerSettings => listenerSettings =>
new ProgressListener { new ProgressListener {
override def progressChanged(progressEvent: ProgressEvent): Unit = private val listener = UploadEventListener.listener(listenerSettings)
UploadEventListener.listener(listenerSettings)( override def progressChanged(progressEvent: ProgressEvent): Unit = {
eventHandler(progressEvent)) listener(eventHandler(progressEvent))
}
private def eventHandler: ProgressEvent => UploadEvent = private def eventHandler: ProgressEvent => UploadEvent =
progressEvent => { progressEvent => {