claudelock

package
v0.1.4521 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package claudelock takes the mkdir locks Claude Code holds while it saves its files, taken as Claude Code takes them (2.1.316, its bundled proper-lockfile): a lock is a directory made with mkdir, held while it stands and let go by removing it. Its holder touches it every few seconds; one not touched for longer than the lock's stale time is left by a holder that died, and is taken over.

Index

Constants

View Source
const (
	// RefreshStale is how long a lock Claude Code refreshes its sign-in
	// under may stand untouched (.oauth_refresh.lock, ~/.claude.lock).
	RefreshStale = 60 * time.Second
	// ConfigStale is how long the lock Claude Code saves ~/.claude.json
	// under may stand untouched.
	ConfigStale = 10 * time.Second
)

Variables

View Source
var ErrHeld = errors.New("Claude Code is saving its settings: try again in a moment")

ErrHeld is a lock Claude Code held past Wait.

View Source
var (
	// Wait is how long a caller waits for Claude Code to let a lock go.
	// A refresh holds them for one token request; Claude Code itself
	// gives up after five tries a second or two apart.
	Wait = 20 * time.Second
)

Functions

func Config

func Config(path string) (release func(), err error)

Config takes the lock Claude Code saves the config file path under: at the file's real path (proper-lockfile resolves it) plus ".lock". A file whose folder isn't there yet (Claude Code never run) has no lock to wait for.

func Take

func Take(path string, stale time.Duration) (release func(), err error)

Take makes the lock directory path, waiting while another holds it and taking over one left stale. Held, it is touched until released.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL