Skip to content

fix(session): ensure proper cleanup of inflight messages on publish failure#2

Merged
bittcrafter merged 2 commits intomasterfrom
dev/0.16.0-optimize
Aug 31, 2025
Merged

fix(session): ensure proper cleanup of inflight messages on publish failure#2
bittcrafter merged 2 commits intomasterfrom
dev/0.16.0-optimize

Conversation

@bittcrafter
Copy link
Copy Markdown
Owner

  • Added error mapping to remove inflight entry if publish() fails
  • Separated ACK sending from publish operation for better error handling
  • Guaranteed inflight message cleanup in both success and error cases

This prevents resource leaks when QoS 1 message publishing fails by ensuring the inflight tracking is properly maintained.

…ailure

- Added error mapping to remove inflight entry if `publish()` fails
- Separated ACK sending from publish operation for better error handling
- Guaranteed inflight message cleanup in both success and error cases

This prevents resource leaks when QoS 1 message publishing fails by ensuring the inflight tracking is properly maintained.
- Replaced `map_err` with `inspect_err` for cleaner error side effects
- Maintains same functionality: removes inflight entry on publish failure
- More idiomatic Rust error handling pattern
- Keeps original error unchanged while performing cleanup
@bittcrafter bittcrafter merged commit 2d7c67b into master Aug 31, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant