Skip to content

Commit

Permalink
Update izumi to 1.1.0-M25
Browse files Browse the repository at this point in the history
  • Loading branch information
neko-kai committed Jul 4, 2023
1 parent adafa44 commit 2953c56
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package izumi.idealingua.runtime.rpc.http4s

import java.util.concurrent.ConcurrentHashMap

import izumi.functional.bio.{IO2, Temporal2, F}
import izumi.fundamentals.platform.language.Quirks._
import izumi.idealingua.runtime.rpc._
import io.circe.Json
import izumi.functional.bio.retry.Scheduler2
import izumi.functional.bio.{F, IO2, Temporal2}
import izumi.fundamentals.platform.language.Quirks.*
import izumi.idealingua.runtime.rpc.*

import java.util.concurrent.ConcurrentHashMap
import scala.concurrent.duration.FiniteDuration

class RequestState[F[+ _, + _]: IO2: Temporal2] {
Expand All @@ -15,6 +15,8 @@ class RequestState[F[+ _, + _]: IO2: Temporal2] {
protected val requests: ConcurrentHashMap[RpcPacketId, IRTMethodId] = new ConcurrentHashMap[RpcPacketId, IRTMethodId]()
protected val responses: ConcurrentHashMap[RpcPacketId, RawResponse] = new ConcurrentHashMap[RpcPacketId, RawResponse]()

private val scheduler2: Scheduler2[F] = implicitly

def methodOf(id: RpcPacketId): Option[IRTMethodId] = {
Option(requests.get(id))
}
Expand Down Expand Up @@ -70,15 +72,15 @@ class RequestState[F[+ _, + _]: IO2: Temporal2] {
}

def poll(id: RpcPacketId, interval: FiniteDuration, timeout: FiniteDuration): F[Nothing, Option[RawResponse]] =
F.sleep(interval)
.flatMap {
scheduler2.retryOrElseUntil {
F.sleep(interval).flatMap {
_ =>
checkResponse(id) match {
case None =>
F.fail(())
case Some(value) =>
F.pure(Some(value)): F[Unit, Some[RawResponse]]
F.pure(Some(value)): F[Unit, Option[RawResponse]]
}
}
.retryOrElse(timeout, _ => F.pure(None))
}
}(timeout, _ => F.pure(None))
}
2 changes: 1 addition & 1 deletion project/project/PluginVersions.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
object PV {
val izumi = "1.1.0-M24"
val izumi = "1.1.0-M25"

val sbt_scoverage = "2.0.8"
val sbt_pgp = "2.1.1"
Expand Down

0 comments on commit 2953c56

Please sign in to comment.