more async bugs

This commit is contained in:
Darryl Nixon 2023-07-16 15:01:37 -07:00
parent f81d1d4a64
commit ec136294c5

View file

@ -63,7 +63,8 @@ async def main(job: argparse.Namespace) -> bool:
async def check_inode_and_unlink(item, inodes): async def check_inode_and_unlink(item, inodes):
async with semaphore: async with semaphore:
if await item.stat().st_ino in inodes: stat = await item.stat()
if await stat.st_ino in inodes:
log_buf = f"Deleting hardlink: {item.path}" log_buf = f"Deleting hardlink: {item.path}"
if not job.dryrun: if not job.dryrun:
log_buf = "DRY RUN " + log_buf log_buf = "DRY RUN " + log_buf
@ -78,6 +79,7 @@ async def main(job: argparse.Namespace) -> bool:
check_paths = [mount_point / path for path in ("/proc", "/dev", "/sys")] check_paths = [mount_point / path for path in ("/proc", "/dev", "/sys")]
manual_process = any(asyncio.gather(*[path.exists() for path in check_paths])) manual_process = any(asyncio.gather(*[path.exists() for path in check_paths]))
if manual_process: if manual_process:
logger.warning("Us")
# Traverse every directory in mount_point recursively except /proc, /dev, and /sys # Traverse every directory in mount_point recursively except /proc, /dev, and /sys
async for item in mount_point.glob("*"): async for item in mount_point.glob("*"):
if await item.is_dir(): if await item.is_dir():