Just something else which may help.
Why every 50ms?
I know the sound of a bark is quite short, but..... 50ms?
Maybe try 500ms.
That will also reduce the load of the arduino.
Also I think it would be more flooding the broker rather than spamming it.
But that is just a term.