You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to add FiniteDuration parsing to the zio-config
Solution of the problem:
case object FiniteDuration extends Primitive[scala.concurrent.duration.FiniteDuration] {
final def parse(text: String): Either[Config.Error, scala.concurrent.duration.FiniteDuration] =
Duration.parse(text).flatMap{
case zio.Duration.Infinity => Left(Config.Error.InvalidData(Chunk.empty, s"Expected a finite duration value, but found ${text}"))
case zio.Duration.Zero => Right(scala.concurrent.duration.Duration.Zero)
case duration => Right(scala.concurrent.duration.FiniteDuration(duration.toNanos, TimeUnit.NANOSECONDS))
}
}
The text was updated successfully, but these errors were encountered:
That said, I can't guarantee it'll be accepted as zio has its own Duration type (which is just an alias for the java.time one, but still). But you can try, after all you've already written the code…
Is it possible to add
FiniteDuration
parsing to thezio-config
Solution of the problem:
The text was updated successfully, but these errors were encountered: