Skip to content

asyncio support#332

Merged
gaborbernat merged 12 commits intotox-dev:mainfrom
Ovizro:main
Jun 11, 2024
Merged

asyncio support#332
gaborbernat merged 12 commits intotox-dev:mainfrom
Ovizro:main

Conversation

@Ovizro
Copy link
Contributor

@Ovizro Ovizro commented Jun 3, 2024

Add asyncio support for filelock

Usage:

import asyncio
from filelock import AsyncFileLock

async def main() -> None:
    lock = AsyncFileLock("test.lock")
    async with lock:
        print("Lock acquired")
        await asyncio.sleep(1)

asyncio.run(main())

The default asynchronous approach in this implementation is to execute _acquire and _release in the thread pool.
Please ask if this is how you would like to see it implemented. If you think this is feasible, I will make further modifications and add tests for it.

@gaborbernat gaborbernat marked this pull request as draft June 4, 2024 00:39
Copy link
Member

@gaborbernat gaborbernat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI failing and no tests.

@Ovizro Ovizro marked this pull request as ready for review June 4, 2024 07:54
@Ovizro Ovizro requested a review from gaborbernat June 6, 2024 06:14
@Ovizro Ovizro requested a review from gaborbernat June 6, 2024 07:09
Copy link
Member

@gaborbernat gaborbernat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants