jedis icon indicating copy to clipboard operation
jedis copied to clipboard

Sleeping time not configurable when reconnecting to Sentinel

Open barbasa opened this issue 2 years ago • 2 comments

Expected behavior

JedisSentinelPool listen to the master messages via a MasterListener. If a connection with a Sentinel is lost, the listener tries to reconnect after a configurable sleeping time.

This can be an issue when several clients get disconnected together. When they will try to re-connect, all of them after 5000ms, to Redis they will create a spike in new connections.

Adding a random factor to the sleeping value, or making it configurable so that the user can define it randomly, would avoid the spike.

Actual behavior

The retry time is hardcoded to 5000ms.

Steps to reproduce:

  1. Setup a Redis cluster using Sentinels
  2. Connect the Santinels in your app
  3. Stop your sentinels
  4. Check the logs. In the logs there will be a message like: "Lost connection to Sentinel at sentinelhost:sentinelport. Sleeping 5000ms and retrying"

The 5000ms is not configgurable.

Redis / Jedis Configuration

Jedis version: 2.10.2

Redis version: 6.2

Java version: 11

barbasa avatar Feb 02 '22 16:02 barbasa

Yes, the sleep time is not configurable. We welcome a PR.

@barbasa Apologies for late reply.

sazzad16 avatar Mar 09 '22 07:03 sazzad16

This issue is marked stale. It will be closed in 30 days if it is not updated.

github-actions[bot] avatar Jan 03 '24 00:01 github-actions[bot]