Skip to content

Commit

Permalink
High load issue libs update (#1090)
Browse files Browse the repository at this point in the history
* wip

* fix for new operation handling

* another small change

* small fix
  • Loading branch information
piotrkosecki authored Apr 22, 2022
1 parent 68d78c0 commit 2cb9191
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
@@ -1,7 +1,6 @@
package tech.cryptonomic.conseil.api.directives

import java.util.UUID

import akka.http.scaladsl.model.StatusCodes.InternalServerError
import akka.http.scaladsl.model._
import akka.http.scaladsl.server.Directives._
Expand All @@ -10,9 +9,10 @@ import akka.http.scaladsl.server.{Directive, ExceptionHandler, Route}
import cats.effect.{Async, IO, Ref}
import tech.cryptonomic.conseil.common.io.Logging.ConseilLogSupport
import org.slf4j.MDC

import cats.effect.unsafe.implicits.global

import scala.concurrent.duration.DurationInt

/** Utility class for recording responses */
class RecordingDirectives(implicit concurrent: Async[IO]) extends ConseilLogSupport {

Expand All @@ -34,7 +34,8 @@ class RecordingDirectives(implicit concurrent: Async[IO]) extends ConseilLogSupp
(for {
requestMap <- requestInfoMap.get
value = RequestValues.fromHttpRequestAndIp(request, ip, stringEntity)
_ <- requestInfoMap.update(_ => requestMap.updated(correlationId, value))
filteredMap = requestMap.filter { case (_, values) => System.nanoTime() - values.startTime < 5.minutes.toNanos }
_ <- requestInfoMap.update(_ => filteredMap.updated(correlationId, value))
} yield ()).unsafeRunSync()

requestMapModify(map =>
Expand Down
4 changes: 2 additions & 2 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ object Dependencies {

val monix = "3.4.0"

val cats = "2.6.1"
val catsEffect = "3.2.9"
val cats = "2.7.0"
val catsEffect = "3.3.9"

val mouse = "0.25"
val monocle = "2.0.0"
Expand Down

0 comments on commit 2cb9191

Please sign in to comment.