Unverified Commit eae23e26 authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files

list new recordSetId only once


Signed-off-by: Sebastian Schüpbach's avatarSebastian Schüpbach <sebastian.schuepbach@unibas.ch>
parent 957a6180
Pipeline #22372 passed with stages
in 5 minutes and 2 seconds
...@@ -21,6 +21,7 @@ package ch.memobase ...@@ -21,6 +21,7 @@ package ch.memobase
import ch.memobase.models.{DeleteMessage, ParserIgnore, Report} import ch.memobase.models.{DeleteMessage, ParserIgnore, Report}
import org.apache.logging.log4j.scala.Logging import org.apache.logging.log4j.scala.Logging
import scala.collection.mutable
import scala.util.{Failure, Success} import scala.util.{Failure, Success}
object App object App
...@@ -35,7 +36,7 @@ object App ...@@ -35,7 +36,7 @@ object App
parse(args) match { parse(args) match {
case Some((sessionId, filters, dryRun)) => case Some((sessionId, filters, dryRun)) =>
try { try {
var recordSetId = "" val recordSetIds: mutable.HashSet[String] = mutable.HashSet()
val matches = Iterator.continually(poll) val matches = Iterator.continually(poll)
.takeWhile(_.nonEmpty) .takeWhile(_.nonEmpty)
.flatten .flatten
...@@ -49,9 +50,9 @@ object App ...@@ -49,9 +50,9 @@ object App
logger.info("Match found") logger.info("Match found")
List(DeleteMessage(rep, sessionId)) List(DeleteMessage(rep, sessionId))
case Success(r) => case Success(r) =>
if (r.recordSetId != recordSetId) { if (!recordSetIds.contains(r.recordSetId)) {
recordSetId = r.recordSetId recordSetIds += r.recordSetId
logger.info(recordSetId) logger.info(r.recordSetId)
} }
List() List()
case Failure(_: ParserIgnore) => case Failure(_: ParserIgnore) =>
......
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