This commit is contained in:
2021-12-22 20:21:24 +01:00
parent a24d39d657
commit a8bd48e09f
17 changed files with 344 additions and 31 deletions

View File

@@ -1,6 +1,7 @@
package handlers
import (
"context"
"downloader/internal/core/ports/download_request"
"downloader/internal/core/ports/downloadhandler"
"fmt"
@@ -20,7 +21,7 @@ func New(repository download_request.Repository, logger *zap.SugaredLogger) down
}
func (o *onDownloadEventHandler) OnTickEvent(downloadId string, progress string) {
download, err := o.repository.GetById(downloadId)
download, err := o.repository.GetById(context.TODO(), downloadId)
if err != nil {
o.logger.Warnw("could not finish updating progress as not download id available",
"downloadId", downloadId,
@@ -28,5 +29,5 @@ func (o *onDownloadEventHandler) OnTickEvent(downloadId string, progress string)
return
}
download.Status = fmt.Sprintf("in-progress: %s", progress)
_ = o.repository.Update(download)
_ = o.repository.Update(context.TODO(), download)
}