MCPcopy Create free account
hub / github.com/tox-dev/filelock / _commit_acquire

Method _commit_acquire

src/filelock/_api.py:1367–1373  ·  view source on GitHub ↗

Record this instance as the holder once the first acquire succeeds, so peers can detect the deadlock.

(self, canonical: str)

Source from the content-addressed store, hash-verified

1365 self._drop_registry_entry()
1366
1367 def _commit_acquire(self, canonical: str) -> None:
1368 """Record this instance as the holder once the first acquire succeeds, so peers can detect the deadlock."""
1369 if self._context.lock_counter == 1:
1370 key = self._registry_key(canonical)
1371 # The holder scope is resolved once at commit so a later release from another flow drops the right entry.
1372 self._context.lock_file_key = key
1373 _registry.held[key] = id(self)
1374
1375 def _drop_registry_entry(self) -> None:
1376 """Forget the key owned by this hold without resolving a mutable path again."""

Callers 3

acquireMethod · 0.95

Calls 1

_registry_keyMethod · 0.95

Tested by

no test coverage detected