-
Notifications
You must be signed in to change notification settings - Fork 12
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 order of disconnection and connection events #64
Merged
bettio
merged 2 commits into
astarte-platform:master
from
Annopaolo:fix-connection-disorder
Nov 11, 2022
Merged
Fix order of disconnection and connection events #64
bettio
merged 2 commits into
astarte-platform:master
from
Annopaolo:fix-connection-disorder
Nov 11, 2022
Conversation
This file contains 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
Codecov Report
@@ Coverage Diff @@
## master #64 +/- ##
==========================================
+ Coverage 73.18% 78.28% +5.09%
==========================================
Files 9 11 +2
Lines 179 221 +42
==========================================
+ Hits 131 173 +42
Misses 48 48
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
rbino
requested changes
Sep 26, 2022
c737110
to
b6709f0
Compare
rbino
requested changes
Oct 3, 2022
b6709f0
to
a11df0a
Compare
a11df0a
to
74916df
Compare
rbino
requested changes
Nov 7, 2022
rbino
approved these changes
Nov 7, 2022
rbino
approved these changes
Nov 10, 2022
In rare corner cases (time difference < 10 ms), the `on_register` hook (reconnection) may be called before the related `on_client_offline/gone` hook (disconnection). This is due to the distributed nature of VerneMQ (see vernemq/vernemq#1741), and results in an invalid device connection state in Astarte: a device may be publishing while being in a disconnected status. Introduce a check on the order of disconnection/reconnection events, and possibly reorder them if such a corner case happens. Fix astarte-platform/astarte#668. Signed-off-by: Arnaldo Cesco <arnaldo.cesco@secomind.com>
During connection/disconnection synchronization, a device should not be able to send messages. Make the handling of connection/disconnection events synchronous, so that VMQ will wait for synchronization before allowing other messages to be sent. As the synchronization lasts at most 50ms, this will not affect standard message flow. Signed-off-by: Arnaldo Cesco <arnaldo.cesco@secomind.com>
8633c8f
to
9bdb074
Compare
bettio
approved these changes
Nov 11, 2022
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.
In rare corner cases (time difference < 10 ms), the
on_register
hook (reconnection) may be called before the relatedon_client_offline/gone
hook (disconnection). This is due to the distributed nature of VerneMQ (see vernemq/vernemq#1741), and results in an invalid device connection state in Astarte: a device may be publishing while being in a disconnected status.Introduce a check on the order of disconnection/reconnection events, and possibly reorder them if such a corner case happens.
During reordering (at most 50ms), other kind of messages (if any) are retained in VMQ memory.
Fix astarte-platform/astarte#668.