ESP32 Long Time MQTT Working Problem

Hi, I am trying to make a connection with mqtt able to send data every minute and be all the time listening to possible commands both mqtt, as modbus rtu and tcp, I've developed the program and if I put it in execution works during the first 12 hours, but from then on it stops sending data every minute and starts to delay more the publication of the data, I have been debugging and the problem seems to be in the publish to the mqtt broker that take a long time (since the connection with modbus tcp and rtu is still working in real time). I found this post from @mertkslkc ( ESP32 Long Time Working Problem) but he didn't seem to find any solution to the problem.
Thanks for any advice.
The versions I used;
Arduino == 1.8.12
ESP32 DEVKITV1
MQTTCLient.h == 2.5.0

Post your code!