Skip to content

Commit

Permalink
Get rid of deprecated zio API usage
Browse files Browse the repository at this point in the history
  • Loading branch information
VladKopanev committed Oct 17, 2019
1 parent 11eb1d2 commit 1ce2f11
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
7 changes: 3 additions & 4 deletions core/src/main/scala/com/vladkopanev/zio/saga/Saga.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.vladkopanev.zio.saga

import com.vladkopanev.zio.saga.Saga.Compensator
import zio.Cause
import zio.{ Cause, Exit, Fiber, IO, RIO, Schedule, Task, UIO, ZIO }
import zio.clock.Clock
import zio.{ Exit, Fiber, IO, Schedule, Task, TaskR, UIO, ZIO }

/**
* A Saga is an immutable structure that models a distributed transaction.
Expand Down Expand Up @@ -195,9 +194,9 @@ object Saga {

implicit def UIOtoCompensable[A](uio: UIO[A]): Compensable[Any, Nothing, A] = new Compensable(uio)

implicit def TaskRtoCompensable[R, A](taskR: TaskR[R, A]): Compensable[R, Throwable, A] = new Compensable(taskR)
implicit def TaskRtoCompensable[R, A](rio: RIO[R, A]): Compensable[R, Throwable, A] = new Compensable(rio)

implicit def TaskToCompensable[A](taskR: Task[A]): Compensable[Any, Throwable, A] = new Compensable(taskR)
implicit def TaskToCompensable[A](task: Task[A]): Compensable[Any, Throwable, A] = new Compensable(task)
// $COVERAGE-ON$

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import com.vladkopanev.zio.saga.example.dao.SagaLogDaoImpl
import com.vladkopanev.zio.saga.example.endpoint.SagaEndpoint
import zio.interop.catz._
import zio.console.putStrLn
import zio.{ App, ZIO }
import zio.{ App, ZEnv, ZIO }

object SagaApp extends App {

import org.http4s.server.blaze._

implicit val runtime = this

override def run(args: List[String]): ZIO[Environment, Nothing, Int] = {
override def run(args: List[String]): ZIO[ZEnv, Nothing, Int] = {
val flakyClient = sys.env.getOrElse("FLAKY_CLIENT", "false").toBoolean
val clientMaxReqTimeout = sys.env.getOrElse("CLIENT_MAX_REQUEST_TIMEOUT_SEC", "10").toInt
val sagaMaxReqTimeout = sys.env.getOrElse("SAGA_MAX_REQUEST_TIMEOUT_SEC", "12").toInt
Expand All @@ -31,8 +31,8 @@ object SagaApp extends App {
_ <- orderSEC.recoverSagas.fork
_ <- BlazeServerBuilder[TaskC].bindHttp(8042).withHttpApp(app).serve.compile.drain
} yield ()).foldM(
e => putStrLn(s"Saga Coordinator fails with error $e, stopping server...").const(1),
_ => putStrLn(s"Saga Coordinator finished successfully, stopping server...").const(0)
e => putStrLn(s"Saga Coordinator fails with error $e, stopping server...").as(1),
_ => putStrLn(s"Saga Coordinator finished successfully, stopping server...").as(0)
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.vladkopanev.zio.saga
import zio.TaskR
import zio.RIO
import zio.clock.Clock

package object example {
type TaskC[+A] = TaskR[Clock, A]
type TaskC[+A] = RIO[Clock, A]
}

0 comments on commit 1ce2f11

Please sign in to comment.