davidzollo commented on PR #10935:
URL: https://github.com/apache/seatunnel/pull/10935#issuecomment-4582034759

   Nice work overall! Two things worth fixing before merge:
   
   **1. `close()` can throw when Paho is mid-reconnect**
   When `automaticReconnect=true`, `isConnected()` returns `false` during a 
reconnect attempt, so you skip `disconnect()` and call `close()` directly. Paho 
will throw `REASON_CODE_CLIENT_NOT_DISCONNECTED` because the client isn't fully 
disconnected yet. A quick fix is calling `disconnectForcibly()` before 
`close()` in that branch.
   
   **2. Throwing from `connectComplete()` silently resets the reconnect 
timeout**
   When resubscribe fails, you set `receiveException` and then throw a 
`MqttConnectorException`. Paho catches that exception in its callback thread 
and calls `shutdownConnection`, which fires `connectionLost` again — resetting 
`disconnectedSinceMs` to `now()`. The timeout clock starts over on every failed 
resubscribe attempt, so the reconnect timeout guard never actually triggers. 
Just drop the `throw`, keep the `receiveException = e` and maybe add a 
log.error; `pollNext` will pick it up on the next cycle.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to