Commit 931c3642 authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Optimize text file validation

parent a8e21e64
Pipeline #25176 passed with stages
in 4 minutes and 10 seconds
......@@ -80,13 +80,14 @@ class Service(fileName: String = "app.yml") {
"$recordSetId#$sessionId",
status = ReportStatus.fatal,
message = "SFTP Exception: ${ex.localizedMessage}",
step = Service.step
step = step
)
producer.sendReport(report)
exitProcess(1)
}
log.info("Retrieved file list from sftp server from folder: $recordSetId")
val reports = mutableListOf<Report>()
var reportCount = 0
var sftpClientExceptions = 0
try {
log.info("Total files: ${files.size}.")
for (file in files) {
......@@ -99,7 +100,7 @@ class Service(fileName: String = "app.yml") {
log.info("Validation ${validationResult.second.status}.")
producer.sendMessage(validationResult.second.id, validationResult.first)
producer.sendReport(validationResult.second)
reports.add(validationResult.second)
reportCount += 1
}
} catch (ex: SftpClientException) {
log.error("SFTP Exception: ${ex.localizedMessage}")
......@@ -107,14 +108,14 @@ class Service(fileName: String = "app.yml") {
file.name,
status = ReportStatus.fatal,
message = "SFTP Exception: ${ex.localizedMessage}.",
step = Service.step
step = step
)
producer.sendMessage(file.name, Message(Formats.error, "SFTP Error"))
producer.sendReport(report)
reports.add(report)
reportCount += 1
sftpClientExceptions += 1
}
}
log.info("Collected a total of ${reports.size} reports.")
log.info("Validated a total of $reportCount files with $sftpClientExceptions SFTP Client Exceptions")
} catch (ex: SftpClientException) {
ex.printStackTrace()
log.error("SFTP Exception: ${ex.localizedMessage}.")
......@@ -123,7 +124,7 @@ class Service(fileName: String = "app.yml") {
"$recordSetId#$sessionId",
status = ReportStatus.fatal,
message = "SFTP Exception: ${ex.localizedMessage}.",
step = Service.step
step = step
)
)
exitProcess(1)
......@@ -135,7 +136,7 @@ class Service(fileName: String = "app.yml") {
"$recordSetId#$sessionId",
status = ReportStatus.fatal,
message = "Unknown Exception: ${ex.localizedMessage}.",
step = Service.step
step = step
)
)
exitProcess(1)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment