Skip to content

Commit

Permalink
Fix logging for applying the topleft correction
Browse files Browse the repository at this point in the history
  • Loading branch information
seakayone committed Aug 23, 2023
1 parent 1d51466 commit 2d0324f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ object MaintenanceEndpointRoutes {
applyTopLeftCorrectionEndpoint.implement(shortcodeStr =>
for {
projectPath <- getProjectPath(shortcodeStr)
_ <- ZIO.logInfo(s"Creating originals for $projectPath")
_ <- MaintenanceActions
.applyTopLeftCorrections(projectPath)
.tap(count => ZIO.logInfo(s"Corrected $count top left images for $projectPath"))
Expand Down
10 changes: 6 additions & 4 deletions src/main/scala/swiss/dasch/domain/MaintenanceActions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ import zio.stream.{ ZSink, ZStream }
object MaintenanceActions {

def applyTopLeftCorrections(projectPath: Path): ZIO[ImageService, Throwable, Int] =
findJpeg2000Files(projectPath)
.mapZIOPar(8)(ImageService.applyTopLeftCorrection)
.map(_.map(_ => 1).getOrElse(0))
.run(ZSink.sum)
ZIO.logInfo(s"Starting top left corrections in $projectPath") *>
findJpeg2000Files(projectPath)
.mapZIOPar(8)(ImageService.applyTopLeftCorrection)
.map(_.map(_ => 1).getOrElse(0))
.run(ZSink.sum) <*
ZIO.logInfo(s"Top left corrections applied in $projectPath")

private def findJpeg2000Files(projectPath: Path) = StorageService.findInPath(projectPath, isJpeg2000)

Expand Down

0 comments on commit 2d0324f

Please sign in to comment.