Check if lock is stale (dead process) and remove if stale. Returns: True if lock was stale and removed, False otherwise
(self)
| 187 | self.is_locked = False |
| 188 | |
| 189 | def _check_stale_lock(self) -> bool: |
| 190 | """Check if lock is stale (dead process) and remove if stale. |
| 191 | |
| 192 | Returns: |
| 193 | True if lock was stale and removed, False otherwise |
| 194 | """ |
| 195 | try: |
| 196 | if self._db.is_lock_stale(self._lock_name): |
| 197 | print( |
| 198 | f"Detected stale platform lock at {self.lock_file_path}. Removing..." |
| 199 | ) |
| 200 | if self._db.break_stale_lock(self._lock_name): |
| 201 | print(f"Removed stale lock file: {self.lock_file_path}") |
| 202 | return True |
| 203 | return False |
| 204 | except KeyboardInterrupt as ki: |
| 205 | handle_keyboard_interrupt(ki) |
| 206 | raise |
| 207 | except Exception as e: |
| 208 | print(f"Warning: Could not check for stale lock: {e}") |
| 209 | return False |
| 210 | |
| 211 | def acquire(self) -> None: |
| 212 | """Acquire the platform lock.""" |
no test coverage detected