Repository navigation
Releases: padcmoi/node-dispatched-tasks
Releases · padcmoi/node-dispatched-tasks
Release list
1.0.1
[1.0.1] - 2026-05-06
- Added optional
finishedTtlDaysoption onDelayedTaskServiceOptions. When set to a positive number, every record written to the FINISH bucket gets a RedisEXTTL offinishedTtlDays × 86400seconds — successful tasks are auto-purged by Redis past that window. Disabled by default; never applies to PENDING / FAILED / CANCELED.
[1.0.0] - 2026-05-06
- Pure-Redis storage. No MariaDB, no TypeORM, no entity, no migrations.
- Four buckets per namespace:
<NS>:PENDING:task-<id>,<NS>:FINISH:task-<id>(success),<NS>:FAILED:task-<id>(handler error / timeout / no handler),<NS>:CANCELED:task-<id>(replayable). - Auto-increment integer IDs via
INCR <NS>:counter. - Polling scheduler (default 1000ms), processes pending tasks in ID order when
scheduledAt <= now. - Weight-aware execution capped by
maxWeight(default 5): a task starts only ifΣ(running.weight) + task.weight <= maxWeight. - Service API:
enqueue,cancel,replay,setWeight,get,has,list.pending,list.finished,list.failed,list.canceled,start,stop. enqueueclampsweightto the livemaxWeight.setWeight(id, weight)updates a still-pending task's weight (also clamped) — useful whenmaxWeightwas lowered between deploys.- Typed dispatch:
enqueue(definition, options)overload infersoptions.datafrom theTaskDefinition<P>generic.defineTask<P, R>already typeddatainsiderun; this propagates the type all the way to the call site. - Cancelled or failed tasks can be replayed;
replay(id)auto-detects the source bucket (CANCELEDorFAILED) and accepts an optional futurescheduledAt(otherwise keeps the original). scheduledAtacceptsDate,number(seconds from now), orstring(ISO date or numeric seconds-from-now).resolveScheduledAtexported as a public utility.- POC emitters accept
scheduledAtandweightvia query string. - Removed:
TypeOrmTaskStore,RedisPriorityIndex,DispatchedTaskentity,configureDispatchedTask,tableName,taskStoreFactory,idempotencyKey,correlationId,source,callback, ULID generator, retry/backoff, ZodinputSchemavalidation. - Removed peer dependencies:
typeorm,zod. Onlyioredisremains.
1.0.0
[1.0.0] - 2026-05-06
- Pure-Redis storage. No MariaDB, no TypeORM, no entity, no migrations.
- Four buckets per namespace:
<NS>:PENDING:task-<id>,<NS>:FINISH:task-<id>(success),<NS>:FAILED:task-<id>(handler error / timeout / no handler),<NS>:CANCELED:task-<id>(replayable). - Auto-increment integer IDs via
INCR <NS>:counter. - Polling scheduler (default 1000ms), processes pending tasks in ID order when
scheduledAt <= now. - Weight-aware execution capped by
maxWeight(default 5): a task starts only ifΣ(running.weight) + task.weight <= maxWeight. - Service API:
enqueue,cancel,replay,setWeight,get,has,list.pending,list.finished,list.failed,list.canceled,start,stop. enqueueclampsweightto the livemaxWeight.setWeight(id, weight)updates a still-pending task's weight (also clamped) — useful whenmaxWeightwas lowered between deploys.- Typed dispatch:
enqueue(definition, options)overload infersoptions.datafrom theTaskDefinition<P>generic.defineTask<P, R>already typeddatainsiderun; this propagates the type all the way to the call site. - Cancelled or failed tasks can be replayed;
replay(id)auto-detects the source bucket (CANCELEDorFAILED) and accepts an optional futurescheduledAt(otherwise keeps the original). scheduledAtacceptsDate,number(seconds from now), orstring(ISO date or numeric seconds-from-now).resolveScheduledAtexported as a public utility.- POC emitters accept
scheduledAtandweightvia query string. - Removed:
TypeOrmTaskStore,RedisPriorityIndex,DispatchedTaskentity,configureDispatchedTask,tableName,taskStoreFactory,idempotencyKey,correlationId,source,callback, ULID generator, retry/backoff, ZodinputSchemavalidation. - Removed peer dependencies:
typeorm,zod. Onlyioredisremains.
0.1.1
[0.1.1] - 2026-05-05
tableNameandtaskStoreFactoryoptions onDispatchedTaskService.configureDispatchedTaskexported.- POC reads
DT_TABLE_NAMEfrom env. - Dual-package
exportswith per-condition types (CJS + ESM). - POC tsconfigs use
Node16+rootDir. - Lib
tsconfig.jsondrops hardcodedtypes: ["node"]. docs/database.mdguide for using the lib without TypeORM (canonical MariaDB DDL + customTaskStore).
0.1.0
[0.1.0] - 2026-05-05
- Public service
DispatchedTaskService(register / enqueue / get / list / retry / cancel / start / stop). - Handler factory
defineTask. - TypeORM store adapter and
DispatchedTaskentity. - Redis priority index adapter with configurable namespace.
- Token-bucket scheduler with atomic claim, timeout, retry/backoff.
- Boot recovery from MariaDB.
- Idempotent enqueue via
idempotencyKey. - Scheduled tasks via
scheduledAt. - ULID
public_idgenerator. - Custom error types.
- Pluggable
Loggerinterface. sourcecolumn as SQLENUM.- POC stack (MariaDB, Redis, phpMyAdmin, NestJS holder, Express emitter, NestJS emitter).
- README, Express guide, NestJS guide.
- Unit tests with in-memory fixtures.