mirror of
https://github.com/Viren070/MediaFusion.git
synced 2025-12-01 23:21:11 +01:00
18 lines
316 B
Python
18 lines
316 B
Python
import aiofiles
|
|
from aiofiles import os
|
|
|
|
|
|
async def acquire_lock():
|
|
try:
|
|
async with aiofiles.open(".lock", "x") as f:
|
|
return True
|
|
except FileExistsError:
|
|
return False
|
|
|
|
|
|
async def release_lock():
|
|
try:
|
|
await os.remove(".lock")
|
|
except FileNotFoundError:
|
|
pass
|