Releases: ori88c/zero-overhead-keyed-promise-lock
Releases · ori88c/zero-overhead-keyed-promise-lock
Improve coding examples in README, add negative test for invalid key
README improvements
Key Features ✨
- README improvements.
First Release
Key Features ✨
- Key-wise Mutual Exclusiveness 🔒: Ensures the mutually exclusive execution of tasks associated with the same key, either to prevent potential race conditions caused by tasks spanning across multiple event-loop iterations, or to optimize performance.
- Graceful Teardown ⏳: Await the completion of all currently pending and executing tasks using the
waitForAllExistingTasksToComplete
method. Example use cases include application shutdowns (e.g.,onModuleDestroy
in Nest.js applications) or maintaining a clear state between unit-tests. A particularly interesting use case is in batch processing handlers, where it allows you to signal the completion of all event handlers associated with a batch. - "Check-and-Abort" Friendly 🙈: The
isActiveKey
getter allows skipping or aborting operations if a lock is already held. - Active Key Metrics 📊: The
activeKeys
getter provides real-time insight into currently active keys - i.e., keys associated with ongoing tasks. - Even-Driven Eviction of Stale Keys: Automatically removes internal locks for keys with no pending or ongoing tasks, ensuring the lock never retains stale keys.
- Comprehensive documentation 📚: Fully documented to provide rich IDE tooltips and enhance the development experience.
- Thoroughly Tested 🧪: Covered by extensive unit tests to ensure reliability.
- Minimal External Dependencies: Internally manages multiple instances of zero-overhead-promise-lock, one per active key. This package focuses on efficient resource management while leveraging a well-tested foundation. Both packages are maintained by the same author 💙, with all other dependencies limited to development.
- ES2020 Compatibility: The
tsconfig
target is set to ES2020. - TypeScript support.