Skip to content

Clean up store when publish cannot be sent - #63

Merged
redboltz merged 1 commit into
redboltz:mainfrom
jspngh:fix/clean-store
May 31, 2026
Merged

redboltz merged 1 commit into
redboltz:mainfrom
jspngh:fix/clean-store

Conversation

@jspngh

@jspngh jspngh commented May 30, 2026

Copy link
Copy Markdown
Contributor

If the publish packet has been added to the store, it needs to be removed again if an error prevents it from being sent.
Otherwise the packet_id, which has been released, may be used again for a next publish packet,
which will cause a PacketIdentifierConflict when trying to add that to the store.
This in turn causes a panic, since unwrap is used when adding the packet to the store.

I ran into this issue for the ReceiveMaximumExceeded case.

@jspngh
jspngh force-pushed the fix/clean-store branch from 337a077 to c1cfc67 Compare May 30, 2026 07:48
@codecov

codecov Bot commented May 31, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.75%. Comparing base (2942119) to head (64bbf33).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #63   +/-   ##
=======================================
  Coverage   91.75%   91.75%           
=======================================
  Files          56       56           
  Lines        7436     7439    +3     
=======================================
+ Hits         6823     6826    +3     
  Misses        613      613           
Files with missing lines Coverage Δ
src/mqtt/connection/core.rs 89.84% <100.00%> (+0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@redboltz

Copy link
Copy Markdown
Owner

@jspngh , Thank you for sending the PR. It looks good to me.
CI reports some clippy error but it is not related to your fix.
Today, I merged some other PR, and at that time, I fixed clippy errors.
Could you rebase your PR from the up to date main branch, then force push the PR ?

If the publish packet has been added to the store, it needs
to be removed again if an error prevents it from being sent.
Otherwise the packet_id, which has been released,
may be used again for a next publish packet, which will cause a
`PacketIdentifierConflict` when trying to add that to the store.
@jspngh
jspngh force-pushed the fix/clean-store branch from c1cfc67 to 64bbf33 Compare May 31, 2026 07:54
@redboltz
redboltz merged commit bdd789b into redboltz:main May 31, 2026
10 checks passed
@jspngh
jspngh deleted the fix/clean-store branch May 31, 2026 11:40
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.

2 participants