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 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}"
if not job.dryrun:
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")]
manual_process = any(asyncio.gather(*[path.exists() for path in check_paths]))
if manual_process:
logger.warning("Us")
# Traverse every directory in mount_point recursively except /proc, /dev, and /sys
async for item in mount_point.glob("*"):
if await item.is_dir():