@antelopejs/interface-redis-scheduler 0.0.9 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,26 +1,28 @@
1
- # @antelopejs/interface-redis-scheduler
1
+ # `@antelopejs/interface-redis-scheduler`
2
2
 
3
3
  <div align="center">
4
- <a href="https://www.npmjs.com/package/@antelopejs/interface-redis-scheduler"><img alt="npm" src="https://img.shields.io/npm/v/@antelopejs/interface-redis-scheduler?style=for-the-badge&labelColor=000000&color=000000"></a>
5
- <a href="./LICENSE"><img alt="License" src="https://img.shields.io/npm/l/@antelopejs/interface-redis-scheduler?style=for-the-badge&labelColor=000000&color=000000"></a>
6
- <a href="https://discord.gg/sjK28QHrA7"><img alt="Discord" src="https://img.shields.io/badge/Discord-18181B?logo=discord&style=for-the-badge&color=000000"></a>
7
- <a href="https://interfaces.antelopejs.com/docs/redis-scheduler"><img alt="Docs" src="https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000"></a>
4
+ <a href="https://www.npmjs.com/package/@antelopejs/interface-redis-scheduler"><img data-illustration alt="npm" src="https://img.shields.io/npm/v/@antelopejs/interface-redis-scheduler?style=for-the-badge&labelColor=000000&color=000000"></a>
5
+ <a href="./LICENSE"><img data-illustration alt="License" src="https://img.shields.io/npm/l/@antelopejs/interface-redis-scheduler?style=for-the-badge&labelColor=000000&color=000000"></a>
6
+ <a href="https://discord.gg/g4pFt6eXqu"><img data-illustration alt="Discord" src="https://img.shields.io/badge/Discord-18181B?logo=discord&style=for-the-badge&color=000000"></a>
7
+ <a href="https://interfaces.antelopejs.com/docs/redis-scheduler"><img data-illustration alt="Docs" src="https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000"></a>
8
8
  </div>
9
9
 
10
- Task scheduling on Redis for AntelopeJS: schedule a task for a given time, and the application runs it when it is due, with up to three retries on failure.
10
+ Task scheduling on Redis for AntelopeJS. You schedule a task for a given time, and a listener in your application runs it when it is due, with up to three retries on failure.
11
+
12
+ Part of [AntelopeJS](https://github.com/AntelopeJS/antelopejs), the TypeScript framework where modules depend on contracts and the application chooses the provider. Built by the team behind [AntelopeJS DMS](https://github.com/AntelopeJS/dms).
11
13
 
12
14
  ## What it offers
13
15
 
14
16
  - `setHandler` registers the function that runs one kind of task.
15
- - `addTask` schedules a task for a Unix timestamp in milliseconds; `removeTask` cancels it.
16
- - `enableListener` starts task processing; `disableListener` closes only the notification subscriber, not the pending timer.
17
- - Tasks live in a Redis sorted set, so they survive restarts and every instance of the application sees the same queue.
17
+ - `addTask` schedules a task for a Unix timestamp in milliseconds. `removeTask` removes the queued entry before it runs.
18
+ - `enableListener` starts task processing. `disableListener` closes only the notification subscriber, not the pending timer.
19
+ - Tasks live in a Redis sorted set, so they survive application restarts and every instance of the application sees the same queue. Each due task goes to one listener.
18
20
 
19
21
  ## Implementations
20
22
 
21
- | Module | Notes |
22
- | ---------------------------------------------------------- | --------------------------------------------- |
23
- | [`@antelopejs/redis`](https://github.com/AntelopeJS/redis) | Also implements `@antelopejs/interface-redis` |
23
+ | Module | Notes |
24
+ | ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
25
+ | [`@antelopejs/redis`](https://github.com/AntelopeJS/redis) | Also implements `@antelopejs/interface-redis`, which supplies the Redis client the scheduler uses |
24
26
 
25
27
  ## Install
26
28
 
@@ -68,9 +70,9 @@ export async function stop() {
68
70
  }
69
71
  ```
70
72
 
71
- Register a handler before you schedule tasks for it: `addTask` throws for an unknown handler name.
73
+ Register a handler before you schedule tasks for it. `addTask` rejects for a handler name that this process has not registered.
72
74
 
73
- `disableListener()` is not a full shutdown or pause: a pending timer and running handlers can continue processing tasks. See the [current lifecycle and delivery limitations](./docs/1.introduction.md#disablelistener) before using it for shutdown.
75
+ `disableListener()` is not a full shutdown or pause. A pending timer and running handlers can continue to process tasks. Read the [lifecycle and delivery limits](./docs/1.introduction.md#disablelistener) before you use it for shutdown.
74
76
 
75
77
  ## Documentation
76
78
 
@@ -78,14 +80,16 @@ Register a handler before you schedule tasks for it: `addTask` throws for an unk
78
80
 
79
81
  ## Compatibility
80
82
 
81
- Requires AntelopeJS core `1.x` and the following peer dependencies:
83
+ The module declares these peer dependencies:
84
+
85
+ <!-- antelopejs-docs-compat:start -->
82
86
 
83
- <!-- docs-compat: ./package.json#peerDependencies -->
87
+ | Package | Supported | Tested with |
88
+ | ----------------------------- | ---------------- | ----------- |
89
+ | `@antelopejs/interface-core` | `>=0.2.4 <1.0.0` | `0.2.4` |
90
+ | `@antelopejs/interface-redis` | `>=0.0.9 <1.0.0` | `0.0.9` |
84
91
 
85
- | Package | Range |
86
- | ----------------------------- | ---------------- |
87
- | `@antelopejs/interface-core` | `>=0.2.4 <1.0.0` |
88
- | `@antelopejs/interface-redis` | `>=0.0.9 <1.0.0` |
92
+ <!-- antelopejs-docs-compat:end -->
89
93
 
90
94
  ## Contributing
91
95
 
package/dist/index.d.ts CHANGED
@@ -119,12 +119,17 @@ export declare function removeTask(handlerName: string, taskInfo: string): Promi
119
119
  /**
120
120
  * Updates the timer for the next task execution
121
121
  * This is called internally whenever the task schedule changes
122
+ * The timer does not keep the process alive on its own; the task stays
123
+ * queued in Redis when the process exits first.
122
124
  */
123
125
  export declare function updateTimer(): Promise<void>;
124
126
  /**
125
127
  * Executes all due tasks
126
128
  * This is called internally by the timer when tasks are due for execution
127
129
  * It includes automatic retry logic for failed tasks
130
+ * While a batch runs in this process, it returns at once, so one listener runs
131
+ * one handler at a time; a batch that resolves ends with updateTimer, which
132
+ * runs the tasks that fell due meanwhile, and one that rejects arms no timer
128
133
  */
129
134
  export declare function runTasks(): Promise<void>;
130
135
  export {};
package/dist/index.js CHANGED
@@ -57,9 +57,6 @@ function setHandler(handlerName, handler) {
57
57
  }
58
58
  /** Redis subscriber client for receiving task updates */
59
59
  let subscriber;
60
- const SubscriberMessageHandlers = {
61
- [SchedulerUpdateMessage]: () => void updateTimer(),
62
- };
63
60
  function createTaskMember(handlerName, taskInfo) {
64
61
  return `${handlerName}:${taskInfo}`;
65
62
  }
@@ -90,11 +87,9 @@ async function enableListener() {
90
87
  if (channel !== SchedulerChannel) {
91
88
  return;
92
89
  }
93
- const handler = SubscriberMessageHandlers[message];
94
- if (!handler) {
95
- return;
90
+ if (message === SchedulerUpdateMessage) {
91
+ void updateTimer();
96
92
  }
97
- handler();
98
93
  });
99
94
  void updateTimer();
100
95
  }
@@ -193,28 +188,27 @@ let timer;
193
188
  /**
194
189
  * Updates the timer for the next task execution
195
190
  * This is called internally whenever the task schedule changes
191
+ * The timer does not keep the process alive on its own; the task stays
192
+ * queued in Redis when the process exits first.
196
193
  */
197
194
  async function updateTimer() {
198
195
  if (locked) {
199
196
  return;
200
197
  }
201
198
  const client = await (0, interface_redis_1.GetClient)();
202
- const taskInfo = (await client.zrange(RedisKey, 0, 0))[0];
203
- if (taskInfo) {
204
- const scoreValue = await client.zscore(RedisKey, taskInfo);
205
- if (!scoreValue) {
206
- return;
207
- }
208
- const score = Number(scoreValue);
209
- if (score < Date.now()) {
210
- await runTasks();
211
- }
212
- else {
213
- if (timer) {
214
- clearTimeout(timer);
215
- }
216
- timer = setTimeout(() => void runTasks(), Math.min(score - Date.now(), MaxTimerDelayMs));
199
+ const [, scoreValue] = await client.zrange(RedisKey, 0, 0, "WITHSCORES");
200
+ if (scoreValue === undefined) {
201
+ return;
202
+ }
203
+ const score = Number(scoreValue);
204
+ if (score < Date.now()) {
205
+ await runTasks();
206
+ }
207
+ else {
208
+ if (timer) {
209
+ clearTimeout(timer);
217
210
  }
211
+ timer = setTimeout(() => void runTasks(), Math.min(score - Date.now(), MaxTimerDelayMs)).unref();
218
212
  }
219
213
  }
220
214
  const TakeDueTasksScript = `
@@ -230,31 +224,44 @@ async function takeDueTasks(client) {
230
224
  * Executes all due tasks
231
225
  * This is called internally by the timer when tasks are due for execution
232
226
  * It includes automatic retry logic for failed tasks
227
+ * While a batch runs in this process, it returns at once, so one listener runs
228
+ * one handler at a time; a batch that resolves ends with updateTimer, which
229
+ * runs the tasks that fell due meanwhile, and one that rejects arms no timer
233
230
  */
234
231
  async function runTasks() {
232
+ if (locked) {
233
+ return;
234
+ }
235
235
  locked = true;
236
+ try {
237
+ await runDueTasks();
238
+ }
239
+ finally {
240
+ locked = false;
241
+ }
242
+ await updateTimer();
243
+ }
244
+ async function runDueTasks() {
236
245
  const client = await (0, interface_redis_1.GetClient)();
237
246
  const tasks = await takeDueTasks(client);
238
- if (tasks.length > 0) {
239
- for (const task of tasks) {
240
- const m = task.match(RetryPattern);
241
- try {
242
- if (m && handlers.has(m[2])) {
243
- await handlers.get(m[2])?.(m[3]);
244
- }
247
+ for (const task of tasks) {
248
+ const m = task.match(RetryPattern);
249
+ try {
250
+ if (m && handlers.has(m[2])) {
251
+ await handlers.get(m[2])?.(m[3]);
245
252
  }
246
- catch (err) {
247
- logging_1.Logging.Error(err);
248
- if (m) {
249
- const retryCount = m[1] ? parseInt(m[1], 10) : 0;
250
- if (retryCount < MaxRetries) {
251
- await client.zadd(RedisKey, Date.now() + RetryDelayMs, `RETRY-${retryCount + 1}:${m[2]}:${m[3]}`);
252
- }
253
+ }
254
+ catch (err) {
255
+ logging_1.Logging.Error(err);
256
+ if (m) {
257
+ const retryCount = m[1] ? parseInt(m[1], 10) : 0;
258
+ if (retryCount < MaxRetries) {
259
+ await client
260
+ .zadd(RedisKey, Date.now() + RetryDelayMs, `RETRY-${retryCount + 1}:${m[2]}:${m[3]}`)
261
+ .catch((writeErr) => logging_1.Logging.Error(writeErr));
253
262
  }
254
263
  }
255
264
  }
256
265
  }
257
- locked = false;
258
- await updateTimer();
259
266
  }
260
267
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAyDA,gCAEC;AAgCD,wCAgBC;AAkBD,0CAEC;AA8BD,0BAcC;AA0BD,gCAMC;AAWD,kCAyBC;AAkBD,4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