MQTT Gateway floods logfile if broker is not reachable
- 
					
					
					
					
 mysgw (the mysensors gateway) sends a continuous flow of error messages to the log file if mysgw is started and the configured mqtt broker is not available. I am running a quite recent version (built on Dec 5, 2018), branch master. 
 My problem with mysgw is the excessive logging. I know I can resolve it by configuring my mqtt broker, but mysgw should not produce such a massive amount of logging if the mqtt broker is not available.Dec 5 11:19:13 raspberrypi mysgw: failed to connect Dec 5 11:19:13 raspberrypi mysgw: GWT:RMQ:MQTT RECONNECT Dec 5 11:19:13 raspberrypi mysgw: connect: Connection refused Dec 5 11:19:13 raspberrypi mysgw: failed to connect Dec 5 11:19:13 raspberrypi mysgw: GWT:RMQ:MQTT RECONNECT Dec 5 11:19:13 raspberrypi mysgw: connect: Connection refused Dec 5 11:19:13 raspberrypi mysgw: failed to connect Dec 5 11:19:13 raspberrypi mysgw: GWT:RMQ:MQTT RECONNECT Dec 5 11:19:13 raspberrypi mysgw: connect: Connection refused Dec 5 11:19:13 raspberrypi mysgw: failed to connectStarted on the command line (only first lines copied, there are hundreds of lines per second): root@raspberrypi:/home/pi# mysgw Dec 05 11:26:42 INFO Starting gateway... Dec 05 11:26:42 INFO Protocol version - 2.3.0 Dec 05 11:26:42 DEBUG MCO:BGN:INIT GW,CP=RPNGL---,VER=2.3.0 Dec 05 11:26:42 DEBUG TSF:LRT:OK Dec 05 11:26:42 DEBUG TSM:INIT Dec 05 11:26:42 DEBUG TSF:WUR:MS=0 Dec 05 11:26:42 DEBUG TSM:INIT:TSP OK Dec 05 11:26:42 DEBUG TSM:INIT:GW MODE Dec 05 11:26:42 DEBUG TSM:READY:ID=0,PAR=0,DIS=0 Dec 05 11:26:42 DEBUG MCO:REG:NOT NEEDED Dec 05 11:26:42 DEBUG MCO:BGN:STP Dec 05 11:26:42 DEBUG MCO:BGN:INIT OK,TSP=1 Dec 05 11:26:42 DEBUG GWT:RMQ:MQTT RECONNECT Dec 05 11:26:42 ERROR connect: Connection refused Dec 05 11:26:42 ERROR failed to connect Dec 05 11:26:42 DEBUG GWT:RMQ:MQTT RECONNECT Dec 05 11:26:42 ERROR connect: Connection refused Dec 05 11:26:42 ERROR failed to connect Dec 05 11:26:42 DEBUG GWT:RMQ:MQTT RECONNECT Dec 05 11:26:42 ERROR connect: Connection refused Dec 05 11:26:42 ERROR failed to connect Dec 05 11:26:42 DEBUG GWT:RMQ:MQTT RECONNECT Dec 05 11:26:42 ERROR connect: Connection refused Dec 05 11:26:42 ERROR failed to connect Dec 05 11:26:42 DEBUG GWT:RMQ:MQTT RECONNECT Dec 05 11:26:42 ERROR connect: Connection refused Dec 05 11:26:42 ERROR failed to connect Dec 05 11:26:42 DEBUG GWT:RMQ:MQTT RECONNECT Dec 05 11:26:42 ERROR connect: Connection refused Dec 05 11:26:42 ERROR failed to connect
 
- 
					
					
					
					
 @cvdenzen would you mind checking if the development branch has the same behavior? (the master branch is only updated when a new release is made so it has not changed since June) 
 
- 
					
					
					
					
 @mfalkvidd The development branch has the same behavior. An edit in core/MyGatewayTransportMQTTClient.cpp (I added a "delay(3000)" after line 148 in reconnectMQTT(void)) made it a lot better! 
 
- 
					
					
					
					
 Looks like this was solved in branch develop at Jan, 6, 2019: 
 98355b2d ( tekka 2019-01-06 18:14:10 +0100 158) delay(1000);
 
- 
					
					
					
					
 Thanks @cvdenzen Adding reference link in case someone needs to check it later: https://github.com/mysensors/MySensors/commit/98355b2d0b68190a87c3ac76698014adb58fc882#diff-407bf395289c3cbd3d7728909c25b3adR186 
 
