All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sttp.client4.httpclient.monix.MonixSequencer.scala Maven / Gradle / Ivy

There is a newer version: 4.0.0-M18
Show newest version
package sttp.client4.httpclient.monix

import cats.effect.Concurrent
import cats.effect.concurrent.Semaphore
import monix.eval.Task
import sttp.client4.internal.httpclient.Sequencer

private[monix] class MonixSequencer(s: Semaphore[Task]) extends Sequencer[Task] {
  override def apply[T](t: => Task[T]): Task[T] = s.withPermit(t)
}

private[monix] object MonixSequencer {
  def create(implicit c: Concurrent[Task]): Task[MonixSequencer] = Semaphore(1).map(new MonixSequencer(_))
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy