You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Key Features :sparkles:<aid="key-features"></a>
@@ -98,7 +99,7 @@ By combining the read and update into a single atomic operation, the code avoids
98
99
99
100
In scenarios where performance considerations require controlling access, in-memory locks can be useful. For example, limiting concurrent access to a shared resource may be necessary to reduce contention or meet operational constraints. In such cases, locks are employed as a semaphore with a concurrency limit of 1, ensuring that no more than one operation is executed at a time.
100
101
101
-
## Use Case Example: Aggregating Intrusion Detection Event Logs :shield:<aid="use-case-example"></a>
102
+
## Use Case Example: Aggregating Intrusion Detection Event Logs :shield:<aid="first-use-case-example"></a>
102
103
103
104
In an Intrusion Detection System (IDS), it is common to aggregate non-critical alerts (e.g., low-severity anomalies) in memory and flush them to a database in bulk. This approach minimizes the load caused by frequent writes for non-essential data. The bulk writes occur either periodically or whenever the accumulated data reaches a defined threshold.
104
105
@@ -227,6 +228,53 @@ export class IntrusionDetectionSystem {
227
228
*__Improved Throughput__: In-memory accumulation remains active while bulk writes occur, reducing backpressure.
Consider a **non-overlapping** variant of `setInterval`, designed for asynchronous tasks:
234
+
A scheduler component that manages a single recurring task while **ensuring executions do not overlap**. The scheduler maintains a fixed interval between start times, and if a previous execution is still in progress when a new cycle begins, the new execution is skipped.
235
+
Additionally, the component supports graceful teardown, meaning it not only stops future executions but also awaits the completion of any ongoing execution before shutting down.
236
+
237
+
The `isAvailable` lock indicator can be used to determine whether an execution should be skipped:
0 commit comments