I noticed strange behavior of subscribe callback when the SYSTEM_THREAD is enabled.
I use the webhook to send some configuration data back to electron after it publishes a “config” topic.
This works great as long as the configuration data are short enough to fit one packet. When data are longer and there are 2 reply packets (index 0 and index 1) things break. Each of the received packets results in calling the callback functions and it seems that the second callback is called before the first one even finish. In result data are corrupted in 90% and the content of a second packet overrides the first one. In 10% of cases data will arrive not corrupted so I assume that this really depends on timing.
If the SYSTEM_THREAD is disabled the callbacks are called sequentially and not concurrently and everything seems to be OK. I cannot disable SYSTEM_THREAD because I need my loop() up and running even in the offline state.
I would very much appreciate any tricks and tips to overcome this issue. Any suggestions?