LSS: Lock State Service

A small HTTP service for managing distributed locks. Useful for keeping pipelines, cron jobs, or system scripts from stepping on each other.


What It Does

LSS lets you create, check, and toggle locks over a simple REST API. No SDKs, no setup - just curl it.


Common Use Cases

  • GitHub Actions Block QA deployments while E2E tests are running.
  • Cron Jobs Skip a run if another process is active.
  • Ad-hoc System Locks Pause scripts or maintenance tasks until certain conditions are met.

API

Create a Lock

POST https://lock-states.deno.dev/locks

Params:

  • l=true|1|T - start locked
  • e=ttl_in_seconds - optional TTL
  • k=custom_auth_key - optional custom key

Response:

{
  "lockId": "01hvkab4t422rap18rwjs2prnm",
  "lockKey": "b749f750-fbe3-11ee-9224-d7fd2399170d"
}

Example (locked for 60s):

curl -X POST "https://lock-states.deno.dev/locks?l=t&e=60"

Check Lock State

GET https://lock-states.deno.dev/locks/:lockId

Status codes:

  • 204 - unlocked
  • 423 - locked
  • 404 - not found

Example:

curl -I https://lock-states.deno.dev/locks/01hvkab4t422rap18rwjs2prnm

Lock / Unlock

Lock:

curl -X PATCH "https://lock-states.deno.dev/locks/:lockId/lock?k=:lockKey"

Unlock:

curl -X PATCH "https://lock-states.deno.dev/locks/:lockId/unlock?k=:lockKey"

Optional e=ttl_in_seconds for temporary locks.


Real Example

Pipeline Wait Step

- name: wait for lock
  run: |
    curl --head -X GET --fail \
         --retry 300 --retry-connrefused --retry-all-errors \
         --retry-delay 30 \
         https://lock-states.deno.dev/locks/:lockId

QA Locking

QA team locks the test environment during runs, blocking redeployments until tests finish. Once the lock clears, deployments resume.


LSS - a minimal lock service for when you just need stuff to wait.

This article was updated on listopad 12, 2025