Conversation
…ality - Introduced a new logging helper in `src/helpers/logging.ts` that provides functionality to extract loggable failure codes from various error types. - Updated `src/helpers/index.ts` to export the new logging helper. - Enhanced unit tests in `test/unit/helpers/logging.spec.ts` to cover various scenarios for the `errorCode` function. - Integrated logging functionality into `ClusteredRedisQueue` and `RedisQueue` classes, ensuring appropriate logging during instance selection, publishing, and error handling. - Added tests to verify logging behavior in different failure scenarios across `ClusteredRedisQueue` and `RedisQueue`.
Contributor
|
All contributors have signed the @imqueue Contribution Terms. ✅ |
Contributor
Author
|
I have read the CLA Document and I hereby sign the CLA |
Mikhus
approved these changes
Aug 20, 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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
What does this PR do?
Reports transport failures that previously left no trace at all, or only with
IMQOptions.verboseenabled — which production does not enable. Every line goes through the configured logger and is written whether or notverboseis set, in line with the documented intent ofIMQOptions.verbose: connection lifecycle messages and internal errors are always written.What is now reported:
send(), as a failure episode: the first rejection names the queue, the operation, the message id and a code, further rejections are counted, and the first successful write reports the recovery with that count. The caller already holds the message id and gets no rejection, so this was observable only through the optionalerrorHandler, which most callers do not pass;A failure reason is never taken from the error as it is: only an allow-listed code is printed — an
IMQ_-prefixed framework code, a systemE…code, a small integer, a known Redis reply code (WRONGTYPE,NOSCRIPT,LOADING, …) or one of a few known Redis-client failure messages mapped to codes of our own. Everything else, including the error's message, stack and class name, is reported asunknown. No line ever carries a message payload, call arguments or a raw Redis key.No control flow, return value, Redis command, round-trip or timer was changed, and no new public API was added — the change is diagnostics only, and a logger which throws cannot influence queue behaviour. One deliberate difference: the line about a worker key that could not be deleted is now written through a contained writer, so a throwing logger can no longer surface there as an unhandled rejection.
Type of change
Checklist
npm test).Contribution terms (required)
I grant the project owner the right to license my contribution
commercially, royalty-free, my contribution stays available under
GPL-3.0, I keep my copyright, and I understand I will receive no fee for
it. If I did not agree, I would not be submitting this contribution.