Skip to content

Commit

Permalink
Merge branch 'bug_21423/error_when_processing_inventories_in_7_2_pr' …
Browse files Browse the repository at this point in the history
…into branches/rudder/7.2
  • Loading branch information
Jenkins CI committed Jul 20, 2022
2 parents 40ffdff + abb22a0 commit e533ab7
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ object Watchers {
* This event assume the file if fully written and avoid the inotify event queue.
*/
trait HandleIncomingInventoryFile {
def addFilePure(file: File): UIO[Unit]
def addFilePure(file: File): IOResult[Unit]

def addFile(file: File): Unit
}
Expand Down Expand Up @@ -313,7 +313,9 @@ class ProcessOldFiles(
}

def addFiles(files: List[File]): UIO[Unit] = {
ZIO.foreach_(files)(fileProcessor.addFilePure)
ZIO.foreach_(files)(file => fileProcessor.addFilePure(file).catchAll(err =>
InventoryProcessingLogger.error(s"Error when processing old inventory file '${file.path}': ${err.fullMsg}")
))
}

def deleteFiles(files: List[ToClean]): UIO[Unit] = {
Expand Down Expand Up @@ -533,12 +535,14 @@ class ProcessFile(
//start the process
ZioRuntime.internal.unsafeRunSync(processMessage().forever.forkDaemon)

def addFilePure(file: File): UIO[Unit] = {
processFile(file).catchAll(err => InventoryProcessingLogger.error(s"Error when adding file '${file.path}' to direct processing"))
def addFilePure(file: File): IOResult[Unit] = {
processFile(file)
}

def addFile(file: File): Unit = {
ZioRuntime.internal.unsafeRunSync(addFilePure(file))
ZioRuntime.internal.unsafeRunSync(addFilePure(file).catchAll(err =>
InventoryProcessingLogger.error(s"Error when adding new inventory file '${file.path}' to processing: ${err.fullMsg}")
))
}

/*
Expand Down

0 comments on commit e533ab7

Please sign in to comment.