Hi and million thanks for referencing the code with a workaround.
Follow up question:
I am observing today that the device is doing the following:
every publish from main is seen exactly once on the Particle console of the device
every publish from the thread is seen duplicated for every one of them, albeit with a difference of 10~20 msec
Example:
Published by 186867126783186723 on 2023-12-01T16:00:41.255Z
Published by 186867126783186723 on 2023-12-01T16:00:41.263Z
I have not coded yet the workaround proposed in your post, this is the first time I see this behaviour on this device (or any device for that matter).
I thought for a second that the device or my code was malfunctioning, but checking the serial console logs of the device only shows one single error per publish (as reported in my first post on this topic). So the device seems to be publishing one message as usual.
I also thought that my browser was malfunctioning and duplicating the publishes, but opening another browser or tab still shows double the publishes (and the timestamp is NOT the same, differs by 10~20 msec).
Can this "WITH_ACK from a thread bug" be playing a role in what I am observing or this is something else?
Thanks again
EDIT: I had somehow managed to duplicate the line with the publish - that's why I got those duplicated publishes - apologies.
It's hard to say. But definitely implement the fix because every publish in Tracker Edge and Monitor Edge occurs from a thread using that technique, as does PublishQueueAsyncRK and PublishQueuePosixRK, so the technique is definitely necessary and does work.