Repository navigation
release: v2.0.5 - accept task-level postDelay/startDelay, keep… - #58
Merged
Merged
Conversation
…t as deprecated aliases enqueue() only read the task-level `delay` and `start` options, although the JSDoc already pointed at `postDelay`. Passing the documented name gave no delay at all. - enqueue() now normalizes task options: `postDelay` / `startDelay` are the current names, `delay` / `start` map onto them and emit a `warning` event in the same deprecation shape the priority and coalescing levels use (once per name per queue instance, so a hot enqueue path isn't flooded). The current name wins when both are given; caller options are never mutated. `postDelay: -1` bypasses an active delay like `delay: -1` did. - getPriorityConfig() / getCoalescingConfig() accept both names in taskOptions. - The scheduler's delay gate now uses nextAvailableTime alone. It used to require the completed task's *priority* postDelay to be positive, so a task-level completion delay on a priority without a postDelay was set but never enforced (true for the old `delay` name as well). - JSDoc, generated types and the README task-option list use the new names. Fixes #51
…t as deprecated aliases (#55)
Contributor
Author
🔒 Dependency Review
|
…g an error listener
When a callback-style task failed, timed out, was aborted or expired, the
queue emitted `error` (before the callback for failures, after it for
expiry). HoldMyTask is an EventEmitter, so with no `error` listener the
emit threw: the process crashed (an unhandled rejection from _startTask,
an uncaught exception from the scheduler for expiry) and, for failures,
the callback never ran.
Task-failure `error` events are now emitted only when a listener is
attached (listenerCount("error") > 0). The failure always reaches the
task's callback with the documented payload ({ type: "error", error },
{ type: "timeout", message }, { type: "canceled", message: "Task was
aborted" }, or the expire Error). Promise-API behaviour is unchanged.
Errors thrown by the user's own callback are still emitted
unconditionally, so a bug in a callback is not silently swallowed.
Fixes #53
Contributor
Author
|
| File | Raw | Δ Raw | Gzipped | Δ Gzipped |
|---|---|---|---|---|
| dist/hold-my-task.mjs | 98.7 kB | +4.6 kB (+4.9%) |
20.8 kB | +1.4 kB |
| dist/utils.mjs | 3.3 kB | — | 1.2 kB | — |
| index.cjs | 1.6 kB | — | 813 B | — |
| index.mjs | 2.4 kB | — | 937 B | — |
| types/index.d.mts | 1.7 kB | — | 564 B | — |
| types/index.d.mts.map | 834 B | — | 299 B | — |
| Total | 108.5 kB | +4.6 kB | 24.5 kB | +1.4 kB |
📊 Generated by bundle-size. Brotli sizes also measured but omitted from the table for brevity.
…g an error listener (#56)
…em silently
The constructor ran `priorities` (and the deprecated `delays`) keys through
parseInt and silently discarded anything that came back NaN, so a config
such as `priorities: { high: { postDelay: 100 } }` simply did nothing.
Keys parseInt could only partly read ("2.5") were silently truncated.
Non-integer keys now emit a `warning` event:
{ type: "invalid-priority", message, option, key, priority }
A key parseInt can't read is still ignored (priority: null); a truncated
key keeps its historical meaning (the truncated priority) but is reported.
Integer keys, including negative ones, are unaffected.
A warning rather than a thrown TypeError, for consistency with how the
library treats other questionable configuration: the constructor never
throws for config, deprecated names are reported through `warning`
events, and invalid runtime config (configurePriority /
configureCoalescingKey) is reported through events rather than thrown.
Throwing would also turn configs that currently construct fine into a
crash on a patch upgrade.
Fixes #54
Reorganize the README into the standard section order: intro and tagline, reference-style badge row with definitions at the bottom (adds the coverage badge from the badges branch), What's New, Key Features, Installation with Node.js requirements (including the require(esm) floor), Quick Start, then the existing usage and API sections, Documentation, quality badges, Contributing, Links and License. Also fixes content that disagreed with the code: - the mangled "Import Options" heading emoji - the "@cldmv/holdmytask/src" import, which is not an exported subpath; replaced with the holdmytask-dev export condition - configurePriority/configureCoalescingKey and coalescing defaults now list postDelay/startDelay (delay/start are deprecated aliases; configurePriority never accepted maxDelay) - Quick Start uses priorities/coalescing instead of the deprecated delays/coalescingWindowDuration options - Testing section names the actual npm scripts (coverage, test:watch, build:ci)
Rewrite all README examples and option descriptions that used
deprecated options:
- delays -> priorities: { [priority]: { postDelay } }
- delay/start in priority, coalescing defaults/keys and the
configure* methods -> postDelay/startDelay
- coalescingWindowDuration/MaxDelay/ResolveAllPromises constructor
options -> coalescing.defaults.*
- the alias example used a non-numeric priority key, which the
constructor silently drops
Add a Deprecated Options table (old -> new) and make clear that the
task-level delay/start and coalescing* overrides are current names.
Fix content that disagreed with the code:
- Deprecation Warning Events: warnings carry type/message/deprecated/
replacement (there is no `source`); output now matches the real
messages and emission order
- Async Initialization: sync:false returns a plain Promise with no
.on(); attach listeners to the awaited instance
- resolveAllPromises:false rejects the non-representative tasks with
"Task was coalesced with a newer task" instead of resolving them
with undefined, and the newest task is the representative
- callback-style failures emit an "error" event that throws when no
listener is attached; document it, add a listener to Quick Start,
and describe the callback error payload shape
- options list: drop onError (not implemented), add healingInterval
and sync
Warnings are no longer only deprecations: #57 reports non-integer priority keys as type "invalid-priority". Describe both warning shapes.
Bumps @cldmv/fix-headers to 2.1.4 and re-runs npm run fix:headers. 0 files' headers were restamped.
Bumps @cldmv/fix-headers from ^2.1.4 to 2.2.0. No file headers changed.
Bump @cldmv/configs ^1.2.0 (locked 1.2.0-1.2.2) to ^1.2.4 (1.2.4). The older shared fix-headers.json forced forceAuthorUpdate and forceLastModifiedAuthorUpdate on; 1.2.4 sets both false, so with fix-headers 2.2.0 @author is never rewritten and @last modified by changes only on real content edits. Restamped files: 0.
Shinrai
approved these changes
Oct 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HoldMyTask v2.0.5 Changelog
Release Date: October 2026
Release Type: Patch
Branch:
release/2.0.5Overview
v2.0.5 fixes three long-standing problems in how the queue reads its options and reports failures. The documented task-level
postDelay/startDelayoptions now actually work (the olddelay/startnames become deprecated aliases), a callback-style task failure no longer crashes the process when noerrorlistener is attached, and aprioritieskey that is not an integer is now reported instead of being dropped silently. The README was rewritten to the CLDMV layout and every example now uses the current API.Runtime behavior changes in a few observable ways, all described below: code that still passes
delayorstarttoenqueue()now receives a deprecationwarningevent, a task-level completion delay is now enforced even when the task's priority has nopostDelayof its own, a callback-style task failure is no longer thrown as an unhandlederrorevent, and a non-integer priority key now produces aninvalid-prioritywarning. No option was removed and no exported signature changed.🐛 Bug Fixes
Task-level
postDelay/startDelayare honored;delay/startare deprecated aliases (#55)enqueue()only read the task-leveldelayandstartoptions, although its JSDoc already pointed atpostDelay. Passing the documented name gave no delay at all.enqueue()now treatspostDelayandstartDelayas the current task-level names, matching the names already used inpriorities,coalescing.defaultsandcoalescing.keys.delayandstartstill work and map onto the new names; when both forms are given, the current name wins.postDelay: -1bypasses an active delay period exactly asdelay: -1did, and the caller's options object is never mutated.getPriorityConfig()andgetCoalescingConfig()accept both names in theirtaskOptionsargument.New warning: each deprecated task-level alias now emits a
warningevent of type"deprecation"(withdeprecatedandreplacementfields), in the same shape the priority and coalescing levels already used. The warning fires once per alias per queue instance, not once per task, so a hot enqueue path does not flood listeners. No warning is emitted when the replacement name is also present.Scheduler fix: the delay gate between tasks used to require the completed task's priority to have a positive
postDelay. A task-level completion delay on a priority without one was recorded but never enforced, which was true of the olddelayname as well. The gate now relies on the computed next-available time alone, so a task-levelpostDelay(ordelay) takes effect regardless of the priority's configuration. Code that relied on a task-level delay being ignored in that situation will now see the delay applied. Closes #51.Callback-style task failures no longer require an
errorlistener (#56)When a callback-style task failed, timed out, was aborted or expired, the queue emitted
error.HoldMyTaskis anEventEmitter, so with noerrorlistener that emit threw: the process crashed (an unhandled rejection for failures, an uncaught exception from the scheduler for expiry), and for failures the task's callback never ran. Task-failureerrorevents are now emitted only when at least oneerrorlistener is attached. The failure always reaches the task's callback with the documented payload ({ type: "error", error },{ type: "timeout", message },{ type: "canceled", message: "Task was aborted" }, or the expiry error).Listeners that are attached see the same events as before. The difference is for queues without one: a callback task failure is no longer thrown. An error thrown by the callback itself is still emitted unconditionally, so a bug inside a callback is not silently swallowed, and the
errorevents for invalidenqueue()arguments and rejectedconfigurePriority()/configureCoalescingKey()input are unchanged. Promise-style tasks are unchanged and report failures only through the rejected promise. Closes #53.Non-integer priority keys are reported instead of dropped silently (#57)
The constructor ran
priorities(and the deprecateddelays) keys throughparseIntand discarded anything that came backNaN, so a config such aspriorities: { high: { postDelay: 100 } }did nothing, and a key such as"2.5"was truncated without notice. Any non-integer key now emits awarningevent of type"invalid-priority"withmessage,option("priorities"or"delays"),keyandpriorityfields. A key that cannot be read as a number is still ignored (priority: null); a fractional key keeps its historical meaning, the truncated priority, but is reported. Integer keys, including negative ones, are unaffected. The constructor still never throws for configuration, so a config that constructed fine on v2.0.4 still constructs fine. Closes #54.🧪 Tests
TaskLevelDelayNames(#55),CallbackErrorWithoutListener(#56) andPriorityKeyValidation(#57).PostDelayAfterAwait(#59) adds deterministic fake-timer coverage forpostDelaywhen the next task is enqueued after awaiting the previous one: promise API afterawait, promise API in the resolving microtask, and callback API enqueuing from the completion callback, in both smart-scheduling and polling modes. All cases pass on the current code; the report in #52 could not be reproduced, and the issue is closed with these tests as regression coverage.📚 Documentation
postDelay/startDelayoptions, the optionalerrorlistener for callback-style tasks, bothwarningevent types (deprecationandinvalid-priority), and a table of every deprecated option with its replacement.types/declarations forenqueue()listpostDelayandstartDelay, withdelayandstartmarked deprecated.🔧 Dependencies
Both are dev dependencies and affect only the
npm run fix:headersscript, which extends@cldmv/configs/fix-headers.json. Onlypackage.jsonand the lockfile changed; no file headers were restamped and the published package is unaffected.@cldmv/fix-headers^2.1.1→^2.2.0, in two steps. 2.1.4 (#61) no longer writes a JavaScript comment into JSON or Markdown files, processes every repeated--input, and never walks dependency folders such asnode_modules. 2.2.0 (#62) makes@Last modified byfollow edits to a file's content only, so a run that merely rewrites a header keeps the recorded editor.@cldmv/configs^1.2.0→^1.2.4(#62). The shared fix-headers config now setsforceAuthorUpdateandforceLastModifiedAuthorUpdatetofalse, so@Authorkeeps the file's creator and@Last modified bychanges only with real content edits. The 1.2.1 and 1.2.2 releases of that package only changed its own CI.Upgrade notes
No breaking API changes — drop-in for v2.0.4, with these behavior differences to check:
delaywithpostDelayandstartwithstartDelayinenqueue()calls. The old names keep working, but each emits onedeprecationwarning per queue instance.postDelay(ordelay) is now enforced even when the task's priority has nopostDelay. If a queue depended on that delay being ignored, remove it from the task options.errorlistener is attached; handle failures in the task callback, or attach anerrorlistener if the queue-level event is wanted.priorities/delaysconfigs for non-integer keys. They behave as before, but now emit aninvalid-prioritywarning.👥 Contributors
Avg: 77.6% ·
9e5a70b· Node lts/*Co-authored-by: Shinrai Shinrai@users.noreply.github.com