Skip to content

Commit

Permalink
Using unsafe FiberRef constuctor available in ZIO 2.0.6 (#1087)
Browse files Browse the repository at this point in the history
* Update zio, zio-test, zio-test-sbt to 2.0.6

* Use unsafe FiberRef constuctor instead of running effectfull constructor via runtime (#1086)

Co-authored-by: Tofu Bot <[email protected]>
Gryum and Tofu-bot authored Jan 23, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 7470a32 commit 87aa40d
Showing 2 changed files with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -21,11 +21,7 @@ object TofuDefaultContext {
* `zio.logging#logContext`.
*/
private[logging] lazy val AnnotatedContextRef: FiberRef[Map[LogAnnotation[_], Any]] =
Unsafe.unsafe(implicit unsafe =>
Runtime.default.unsafe
.run(ZIO.scoped(FiberRef.make[Map[LogAnnotation[_], Any]](Map.empty)))
.getOrThrow()
)
Unsafe.unsafe(implicit unsafe => FiberRef.unsafe.make[Map[LogAnnotation[_], Any]](Map.empty))

private[logging] def getValueUnsafe[A](key: LogAnnotation[A])(m: Map[LogAnnotation[_], Any]): Option[A] =
m.get(key).asInstanceOf[Option[A]]
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ object Dependencies {

val zio = "1.0.17"

val zio2 = "2.0.5"
val zio2 = "2.0.6"

val zioCats = "2.5.1.0"

0 comments on commit 87aa40d

Please sign in to comment.