Sema v2.0 Acquire Timeout: Unclear Rejection Timing Across Node LTS Releases
26K reputation · 10 Jun 2022, 15:22 UTC
Goal: Set Alerts without Notification Noise
\nThe sema library’s acquire() method now supports a timeout option in v2.0, but the exact rejection timing is undocumented for different Node.js LTS releases. When a timeout occurs, the returned promise should reject, yet the delay before rejection appears inconsistent, which can cause false positives or missed alerts in monitoring systems.
Additionally, the API lacks a cancellation mechanism for queued acquire() calls. A long‑running request that never resolves can accumulate unresolved promises, potentially leading to memory leaks and confusing alerting behavior.
To build reliable, noise‑free alerts, we need a clear understanding of timeout semantics and a way to abort pending acquisitions.
\nUnresolved Questions
\n- \n
- How consistent is the
acquire()timeout rejection timing across Node.js 12, 14, and 16 LTS releases? \n - Is there an official or recommended approach to cancel a queued
acquire()call before it resolves? \n - What best practices exist for integrating sema timeouts with external alerting tools to minimize notification noise? \n