| 133 | misses: Final[itertools.count[int]] = itertools.count() |
| 134 | |
| 135 | def lstat(path: str | os.PathLike[str]) -> os.stat_result: |
| 136 | if leases and os.fspath(path).endswith(marker.name): |
| 137 | # A single miss may be a peer's break in flight, so the loss only counts on the second. |
| 138 | if next(misses): |
| 139 | leases.clear() |
| 140 | gc.collect() |
| 141 | raise FileNotFoundError(ENOENT, "No such file or directory", marker.name) |
| 142 | return real_lstat(path) |
| 143 | |
| 144 | def fstat(fd: int) -> os.stat_result | SimpleNamespace: |
| 145 | # The collected lease has closed its descriptor by the time the heartbeat inspects it. |