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

add counter

parent 1f2e8fb5
Pipeline #22355 passed with stages
in 5 minutes and 18 seconds
......@@ -36,20 +36,27 @@ object App
case Some((sessionId, filters, dryRun)) =>
try {
val matches = Iterator.continually(poll)
.takeWhile(_.nonEmpty)
.flatten
.flatMap(record => Report(record) match {
case Success(rep) if filters.forall(f => f(rep)) =>
logger.debug("Match found")
List(DeleteMessage(rep, sessionId))
case Success(_) =>
List()
case Failure(_: ParserIgnore) =>
logger.debug("Ignoring irrelevant message")
List()
case Failure(ex) =>
logger.warn(s"Ignoring message because parsing failed: ${ex.getMessage}")
logger.info(s"${record.value()}")
List()
.zip(Iterator.from(1))
.flatMap(record => {
if (record._2 % 250000 == 0) {
logger.info(s"${record._2} records processed so far")
}
Report(record._1) match {
case Success(rep) if filters.forall(f => f(rep)) =>
logger.debug("Match found")
List(DeleteMessage(rep, sessionId))
case Success(_) =>
List()
case Failure(_: ParserIgnore) =>
logger.debug("Ignoring irrelevant message")
List()
case Failure(ex) =>
logger.warn(s"Ignoring message because parsing failed: ${ex.getMessage}")
logger.info(s"${record._1.value()}")
List()
}
}).toSet
logger.info(s"${matches.size} matches found")
matches.foreach(msg => sendDelete(msg, dryRun))
......
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