Skip to content

Commit

Permalink
fix: Eager initialization of Lettuce resources outside Resource (#424)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubjanecek authored Jan 14, 2021
1 parent 950c59e commit 0403831
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ object LettuceModule {

/** Makes [[io.lettuce.core.RedisClient]] initialized with the given config and optionally [[io.lettuce.core.resource.ClientResources]]. */
def makeClient[F[_]: Sync](config: LettuceConfig, clientResources: Option[ClientResources] = None): Resource[F, RedisClient] = {
val create = clientResources match {
lazy val create = clientResources match {
case Some(resources) => RedisClient.create(resources)
case None => RedisClient.create()
}
Expand Down
4 changes: 2 additions & 2 deletions site/docs/subprojects/lettuce.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ implicit val runtime = zio.Runtime.default // this is just needed in example
implicit val lettuceCodec: RedisCodec[String, String] = StringCodec.UTF8

for {
connection <- LettuceModule.makeConnection[Task, String, String](LettuceConfig("redis://localhost"))
value <- Resource.liftF(Task.effect(connection.sync().get("key")))
connection <- LettuceModule.makeConnection[Task, String, String](LettuceConfig("redis://localhost"))
value <- Resource.liftF(Task.effect(connection.sync().get("key")))
} yield value
```

0 comments on commit 0403831

Please sign in to comment.