-
Notifications
You must be signed in to change notification settings - Fork 531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent Hotswap#get
from acquiring a lock when there is no Resource
present
#3922
Changes from 6 commits
3b12e3e
3fe4f8c
8e1ff54
281b9db
3f43315
139d3f2
bd3472c
c04e123
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,6 +165,16 @@ class HotswapSpec extends BaseSpec { outer => | |
|
||
TestControl.executeEmbed(go, IORuntimeConfig(1, 2)).replicateA_(1000) must completeAs(()) | ||
} | ||
} | ||
|
||
"get should not acquire a lock when there is no resource present" in ticked { | ||
implicit ticker => | ||
val go = Hotswap.create[IO, Unit].use { hs => | ||
hs.get.useForever.start *> | ||
hs.swap(IO.sleep(1.second).toResource) *> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should insert a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed! |
||
IO.sleep(2.seconds) *> | ||
hs.get.use_.timeout(1.second).void | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if the rest tests anything meaningful. |
||
} | ||
go must completeAs(()) | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the original comment was okay, the lock is an implementation detail.