Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use truncated exponential backoff for reconnection
When the communication with the Riemann server is connected (TCP/TLS) and the link breaks, riemann-wrapper drop the events that failed to be send, log a warning, and immediatly try to reconnect and proceed with remaining data. When the Riemann server is unreachable because of some network connectivity issue, this new connection will likely immediatly fail, freshly gathered events will be dropped, a new warning will be logged, and a new connection will be tried immediatly. Because we do not wait before reconnecting, we log an unexpectedly large amount of information about dropped messages, and because of the delays introduced by the reconnection attempts, we might be sending stale data when the connection succeed again. Rework the deconnection detection logic to apply some truncated exponential backoff when the connection dies. Sleep at least 0.5 and at most 30s between attempts, and drop any pending events before trying to reconnect.
- Loading branch information