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

Execute MQTT client synchronously in main loop() #1201

Closed

Commits on Aug 2, 2023

  1. execute MQTT client synchronously in main loop()

    processing a published valued on a subscribed topic is currently running
    in a task that is not the task executing the main loop(). that's because
    the espMqttClient(Secure) was constructed without arguments, which
    selects the constructor with two arguments (priority and core), both of
    which have default values. that constructor selects
    espMqttClientTypes::UseInternalTask::YES, causing a task to be created
    in whose context the MQTT client loop is executed.
    
    MQTT subscribers assume they are running in the same context as the main
    loop(). most code assumes exactly that. as the scheduler is preemptive
    and very little (none at all?) code is interlocked, we have to make sure
    to meet the programmer's expectations.
    
    this changeset calls the MQTT client loop in the context of the main
    loop() and enforces the use of espMqttClientTypes::UseInternalTask::NO.
    schlimmchen committed Aug 2, 2023
    Configuration menu
    Copy the full SHA
    c7d7387 View commit details
    Browse the repository at this point in the history