The state machine is confusing. It has one state (RETRYING) that is not used at all. The machine slides directly from CONNECTED into SUBSCRIBED without checking any connections or doing any work. There's a bug in that only new data to upload can drain the queue of delayed messages - this should be drained as soon as the system has the time. And the "delayed retry" mechanism is not for retries at all, it is for polling / driving the work loop.
The state machine is confusing. It has one state (RETRYING) that is not used at all. The machine slides directly from CONNECTED into SUBSCRIBED without checking any connections or doing any work. There's a bug in that only new data to upload can drain the queue of delayed messages - this should be drained as soon as the system has the time. And the "delayed retry" mechanism is not for retries at all, it is for polling / driving the work loop.