Check if any holder exists for this lock. Args: lock_name: Name identifying the lock Returns: True if any process holds this lock
(self, lock_name: str)
| 202 | conn.close() |
| 203 | |
| 204 | def is_held(self, lock_name: str) -> bool: |
| 205 | """Check if any holder exists for this lock. |
| 206 | |
| 207 | Args: |
| 208 | lock_name: Name identifying the lock |
| 209 | |
| 210 | Returns: |
| 211 | True if any process holds this lock |
| 212 | """ |
| 213 | conn = self._get_connection() |
| 214 | try: |
| 215 | cursor = conn.cursor() |
| 216 | cursor.execute( |
| 217 | "SELECT COUNT(*) FROM lock_holders WHERE lock_name = ?", |
| 218 | (lock_name,), |
| 219 | ) |
| 220 | row = cursor.fetchone() |
| 221 | return row is not None and row[0] > 0 |
| 222 | finally: |
| 223 | conn.close() |
| 224 | |
| 225 | def get_lock_info(self, lock_name: str) -> list[dict[str, Any]]: |
| 226 | """Get all holders for a lock with metadata. |