-
-
Notifications
You must be signed in to change notification settings - Fork 139
Add lock to ReAwaitable for concurrent awaits #2109
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
base: master
Are you sure you want to change the base?
Changes from 3 commits
3743454
6aa1d5e
da67d3e
3699bef
4d646e9
94d5b1f
3e7fed1
2d8ae80
a1206af
8de824f
6c0991e
cd15fed
1f05117
b22a7fb
22d1bab
fe8bead
ef55f4e
ed2720a
68ad7c5
6d5fe41
b0bc6b2
3bc5cf4
8c8d91e
c2d0131
5e3929e
e95c17b
302e42c
c1db704
5847569
a396766
a9b0c38
c6cea81
0f12724
35b1c1d
cf54ab1
9d1046e
69c3d8b
606012c
2d3a0cb
bb64b42
5775111
e0055b9
d4b0317
f7cf172
5e7c0ee
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 | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,21 @@ | ||||||
import anyio | ||||||
import pytest | ||||||
|
||||||
from returns.primitives.reawaitable import ReAwaitable | ||||||
|
||||||
|
||||||
async def sample_coro(): | ||||||
|
async def sample_coro(): | |
async def sample_coro() -> str: |
Outdated
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.
await anyio.sleep(0.1) | |
await anyio.sleep(1) |
give less chance for random failures.
Outdated
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.
async def test_concurrent_awaitable(): | |
async def test_concurrent_awaitable() -> None: |
Outdated
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.
Please, add a link to the original bug on github.
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.
It is not in list of production deps:
returns/pyproject.toml
Lines 51 to 57 in bbfc3d3
Can we use
if
s to find the correct lock type?Uh oh!
There was an error while loading. Please reload this page.
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 see, but unfortunately i am not familiar with other libraries than pure
asyncio
.Is it appropriate to use
asyncio.Lock
?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.
Thank you for the fast review!
Uh oh!
There was an error while loading. Please reload this page.
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.
ah maybe something like this?
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.
yes, this
try
is fine :)