Skip to content

Commit

Permalink
Fix bin-compat issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kyri-petrou committed Jul 10, 2024
1 parent 06e36e8 commit b3a3165
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions zio-query/shared/src/main/scala/zio/query/ZQuery.scala
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ final class ZQuery[-R, +E, +A] private (private val step: ZIO[R, Nothing, Result
ZIO.uninterruptibleMask { restore =>
ZIO.withFiberRuntime[R, E, A] { (state, _) =>
val scope = QueryScope.make()
state.setFiberRef(ZQuery.currentCache, cache)
state.setFiberRef(ZQuery.currentCache, Some(cache))
state.setFiberRef(ZQuery.currentScope, scope)
restore(runToZIO).exitWith { exit =>
state.deleteFiberRef(ZQuery.currentCache)
Expand Down Expand Up @@ -1460,8 +1460,8 @@ object ZQuery {
* submitted at once
*/
def fromRequest[R, E, A, B](
request0: A
)(dataSource0: DataSource[R, A])(implicit ev: A <:< Request[E, B], trace: Trace): ZQuery[R, E, B] =
request0: => A
)(dataSource0: => DataSource[R, A])(implicit ev: A <:< Request[E, B], trace: Trace): ZQuery[R, E, B] =
ZQuery {
ZQuery.currentCache.getWith {
case Some(cache) => cachedResult(cache, dataSource0, request0).toZIO
Expand All @@ -1474,8 +1474,8 @@ object ZQuery {
* caching to the query.
*/
def fromRequestUncached[R, E, A, B](
request: A
)(dataSource: DataSource[R, A])(implicit ev: A <:< Request[E, B], trace: Trace): ZQuery[R, E, B] =
request: => A
)(dataSource: => DataSource[R, A])(implicit ev: A <:< Request[E, B], trace: Trace): ZQuery[R, E, B] =
new ZQuery(uncachedResult(dataSource, request)).uncached

/**
Expand Down Expand Up @@ -1827,6 +1827,10 @@ object ZQuery {
(bs.result(), cs.result())
}

@deprecated("No longer used, kept for binary compatibility only", "0.7.4")
val cachingEnabled: FiberRef[Boolean] =
FiberRef.unsafe.make(true)(Unsafe.unsafe)

val currentCache: FiberRef[Option[Cache]] =
FiberRef.unsafe.make(Option.empty[Cache])(Unsafe.unsafe)

Expand Down

0 comments on commit b3a3165

Please sign in to comment.