Skip to content
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

[SYS] Implement a central queue #1767

Merged
merged 11 commits into from Nov 8, 2023
Merged

[SYS] Implement a central queue #1767

merged 11 commits into from Nov 8, 2023

Conversation

1technophile
Copy link
Owner

@1technophile 1technophile commented Oct 3, 2023

Description:

To avoid concurrency issues when modules or/and gateways are publishing data. A queue system was previously in place for the BT gateway. With this PR it is now used by all the modules.
Previously having different modules potentially assigned to different cores was generating MQTT disconnections.

  • Simplify signature
  • BuildBTtopic outside of main
  • Cherry pick 1736
  • Improve queue size
  • Simplify Hapresence
  • Allocate json buffer in the heap to avoid overloading the callback

Why not use the FreeRTOS queue management function? I gave it a try but was not satisfied with the stability and got better stability with the stl

Checklist:

  • The pull request is done against the latest development branch
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • I accept the DCO.

@1technophile 1technophile marked this pull request as draft October 3, 2023 22:04
@1technophile 1technophile force-pushed the central-queue branch 3 times, most recently from 662bfd0 to 0acb6f1 Compare October 5, 2023 13:29
@1technophile 1technophile marked this pull request as ready for review October 6, 2023 01:03
Copy link
Collaborator

@h2zero h2zero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a couple comments.

main/ZgatewayBT.ino Show resolved Hide resolved
main/ZsensorRN8209.ino Show resolved Hide resolved
main/ZgatewayBT.ino Show resolved Hide resolved
to avoid concurrency issue when modules or/and gateways want to publish data

Simplify signature
BuildBTtopic outside of main
Cherry pick 1736
Improve queue size
Simplify Hapresence
Allocate json buffer in the heap to avoid overloading the callback
Also check the content of the entries before assignments to the json
Indeed the char array used to build the json object does not exist anymore so for the moment we don't use the enqueue method for acknowledgement
@1technophile 1technophile merged commit 029409c into development Nov 8, 2023
142 checks passed
@1technophile 1technophile deleted the central-queue branch November 8, 2023 13:26
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.

None yet

2 participants