diff --git a/publishing/webhook-receiver.py b/publishing/webhook-receiver.py index cce134c..90c8ae3 100644 --- a/publishing/webhook-receiver.py +++ b/publishing/webhook-receiver.py @@ -107,8 +107,7 @@ def run(cmd, timeout, cwd=None): def deploy(commit_hint=""): """Pull main, rebuild, republish. Returns (ok, log_tail).""" try: - with open("/dev/null") as devnull: - fcntl.flock(deploy_lock_file, fcntl.LOCK_EX | fcntl.LOCK_NB) + fcntl.flock(deploy_lock_file, fcntl.LOCK_EX | fcntl.LOCK_NB) except BlockingIOError: return False, "another deploy is already running; skipped" @@ -133,6 +132,8 @@ def deploy(commit_hint=""): log.exception("deploy failed") tail.append(f"error: {exc}") return False, "\n".join(tail) + finally: + fcntl.flock(deploy_lock_file, fcntl.LOCK_UN) class Handler(BaseHTTPRequestHandler):