Skip to main content
nestrs-locks provides lease-based exclusivity (in-memory or Redis). Use it for schedule single-runner jobs, leader election light, and critical sections that must not overlap across processes.

Install

Usage

Options

Pick TTL shorter than the duplicate work you can tolerate after a crash, but long enough that healthy work does not lose the lease mid-flight. Extend on long steps.

Schedule single-runner

Combine with ScheduleModule (schedule feature): acquire a named lock at the start of #[cron] / #[interval] handlers so only one replica runs the job.

See also