Skip to main content

Module instance_lock

Module instance_lock 

Source
Expand description

One process per access connector token on a host. Keeps a second bwac from running with the same access connector token on one host.

The lock lives where every account on the host can reach it, so it also catches a bwac started from a console under another account. The cost is that any local account can take the lock for a token first, since the API key ID is not secret, and keep the connector exiting with code 5. The lock only saves wasted work: the server hands each job to one connector, so two processes on one token can’t both rotate it.

Modules§

platform 🔒
An abstract socket. It has no file, so the systemd unit’s PrivateTmp and ProtectSystem can’t hide it from a console run. Abstract sockets are per network namespace, so a process in another namespace (a container, for example) doesn’t see the lock.

Structs§

InstanceLock
Held for the life of the process. The operating system releases it when the process exits, even after a crash.

Enums§

InstanceLockError
Why acquire did not take the lock.

Functions§

acquire
Takes the host-wide lock for the token whose API key ID is api_key_id.
lock_name 🔒