-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: prevent store message on store when it's restored #1255
fix: prevent store message on store when it's restored #1255
Conversation
c0de669
to
9893ddc
Compare
3f5084c
to
5449aaf
Compare
Rebased with the latest master. |
hey @ogis-fujiwara, looks good. could you provide a repro of this behavior? I want to add a test to actually catch this behavior we can demonstrate that this is fixing the bug, and that any future changes don't rollback this fix. |
5449aaf
to
2fbf224
Compare
Added a replay test. We have also confirmed that the bug is fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still not positive that this is the right move. You're removing the storage of the message which could create a new case with a bug.
What would happen if we follow your repro but after it reconnects it sends the initial packet again which is lost? It's not stored in the store before sending so it will not be resent...
2fbf224
to
6d77f3e
Compare
PR did not seem to solve the essential problem. The underlying problem was that external stores, such as mqtt-level-db, sometimes did not return callbacks in the order they were requested. The callbacks for the external store are called in no particular order, as shown in the following link. Added an internal queue so that it does not depend on the callback timing of the external store. |
@YoDaMa , @ogis-yamazaki and I are working on the same project that uses MQTT.js. I believe that this PR is ready to merge. |
6d77f3e
to
1384c3c
Compare
Rebased on the latest main branch. Overtaking still occurs in v4.3.7, so this PR is needed. |
c0d4990
to
f2c33b0
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1255 +/- ##
==========================================
+ Coverage 86.22% 86.25% +0.03%
==========================================
Files 13 13
Lines 1314 1317 +3
==========================================
+ Hits 1133 1136 +3
Misses 181 181
☔ View full report in Codecov by Sentry. |
d1b24e9
to
c3ef368
Compare
Is this still good to merge? |
4d310a5
to
e6c80b2
Compare
Rebased PR using the latest main branch. |
b623c46
to
9ea980c
Compare
Added reproduction test case for mqttjs#1254
9ea980c
to
f0ce93f
Compare
I've added a comment. |
Cause
The message restored from the store was written to the store again before sending.
The writing is a time-consuming process of updating the stored message.
Meanwhile, next message overtook.
Fixes
The restored message was sent without being written to the store.
Added noStore flag to _sendStore function.