UpdateSemaphore
Updates a semaphore’s description and/or permits. Permits can be raised freely; it can only be
lowered down to the current active_holds.
Safe to retry.
Request
metadatais an optional, opaque map of string key/value pairs stored alongside the semaphore — see Metadata.expected_versionenables optimistic locking: the update is applied only if it equals the semaphore’s currentversion. See Updates.
{
"namespace_name": "third_parties",
"semaphore_name": "partner_1",
"description": "Partner 1 API (raised capacity)",
"permits": 30,
"expected_version": 1,
"metadata": {
"vendor": "partner-1"
}
}
Response
- Returns
NotFoundif the namespace does not exist. - Returns
NotFoundif the semaphore does not exist. - Returns
InvalidArgumentifexpected_versiondoes not match the semaphore’s currentversion. - Returns
InvalidArgumentif the newpermitsis below the currentactive_holds(after pruning expired holders). - Expired holders are pruned during the call so a stale
active_holdscannot block a legitimate shrink. last_activity_atis not affected by updates — it only advances onAcquireSemaphore/ReleaseSemaphore.
{
"semaphore": {
"name": "partner_1",
"description": "Partner 1 API (raised capacity)",
"permits": 30,
"active_holds": 3,
"active_holders_count": 1,
"version": 2,
"created_at": 1695826239671432000,
"updated_at": 1695826239925421000,
"last_activity_at": 1695826239671432000,
"metadata": {
"vendor": "partner-1"
}
}
}