Skip to content

Commit 5298cd6

Browse files
kyri-petrouXiNiHa
authored andcommitted
Avoid usage of ZIO.scoped in APQ wrapper (ghostdogpr#2214)
1 parent 4860a15 commit 5298cd6

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

core/src/main/scala/caliban/Configurator.scala

+7
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ object Configurator {
4040
): ZIO[R, E, A] =
4141
configRef.locally(cfg)(f)
4242

43+
private[caliban] def locallyWith[R, E, A](
44+
cfg: ExecutionConfiguration => ExecutionConfiguration
45+
)(
46+
f: ZIO[R, E, A]
47+
): ZIO[R, E, A] =
48+
configRef.locallyWith(cfg)(f)
49+
4350
/**
4451
* Skip validation of the query.
4552
* @param skip if true, the query will not be validated (in that case, the `validations` field is ignored).

core/src/main/scala/caliban/wrappers/ApolloPersistedQueries.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ object ApolloPersistedQueries {
6262
): Document => ZIO[R1, ValidationError, ExecutionRequest] =
6363
(doc: Document) =>
6464
docVar.await.flatMap {
65-
case Some((_, Some(_))) => ZIO.scoped[R1](Configurator.setSkipValidation(true) *> f(doc))
65+
case Some((_, Some(_))) => Configurator.locallyWith(_.copy(skipValidation = true))(f(doc))
6666
case Some((hash, None)) => f(doc) <* ApolloPersistence.add(hash, doc)
6767
case None => f(doc)
6868
}

0 commit comments

Comments
 (0)