Troubleshooting MQTT Topic Limitations with ESP8266

I’ve been working on integrating my ESP8266 device with MQTT for home automation, and I’ve encountered an interesting challenge. I’m currently publishing data from two switches and monitoring indoor temperature and humidity. Everything works smoothly with these four topics. However, when I tried adding outdoor temperature and humidity sensors, the ESP8266 stopped publishing all topics beyond the fourth one. I’ve added delays between publications, but that didn’t resolve the issue. Here’s the relevant code snippet I’m using:

cpp
char fan1_state_topic;
char louver_state_topic;
char indoor_temp_topic;
char indoor_humidity_topic;
char outside_temp_topic;
char outside_humidity_topic;

// Publishing logic for each topic
if (Fan1Status == 0) {
client.publish(“fan1_state_topic”, “OFF”);
delay(100);
}
// Similar blocks for other topics

I noticed that moving the client.publish statements around changes which topics are published, but I still can’t get more than four topics to work simultaneously. This is puzzling because I expected MQTT to handle more topics without such limitations. I’m curious if there’s a known restriction or if I’m missing something in the configuration. Has anyone else encountered this issue or found a workaround? I’d appreciate any insights or suggestions to resolve this challenge.