Check if ALL holders have dead PIDs. Args: lock_name: Name identifying the lock Returns: True if lock is stale (all holders dead), False otherwise
(self, lock_name: str)
| 255 | conn.close() |
| 256 | |
| 257 | def is_lock_stale(self, lock_name: str) -> bool: |
| 258 | """Check if ALL holders have dead PIDs. |
| 259 | |
| 260 | Args: |
| 261 | lock_name: Name identifying the lock |
| 262 | |
| 263 | Returns: |
| 264 | True if lock is stale (all holders dead), False otherwise |
| 265 | """ |
| 266 | holders = self.get_lock_info(lock_name) |
| 267 | if not holders: |
| 268 | return False |
| 269 | |
| 270 | for holder in holders: |
| 271 | pid = holder["owner_pid"] |
| 272 | if is_process_alive(pid): |
| 273 | return False |
| 274 | |
| 275 | return True |
| 276 | |
| 277 | def break_stale_lock(self, lock_name: str) -> bool: |
| 278 | """Remove rows where owner PID is dead. |