Skip to content

Commit

Permalink
Address effects on CLIENT PAUSE due to changes in Redis unstable
Browse files Browse the repository at this point in the history
  • Loading branch information
sazzad16 committed Nov 10, 2021
1 parent 652a782 commit d2b46ba
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,10 @@ public void waitReplicas() {
public void clientPause() throws InterruptedException, ExecutionException {
ExecutorService executorService = Executors.newFixedThreadPool(2);
try {
final Jedis jedisToPause1 = createJedis();
final Jedis jedisToPause2 = createJedis();
final Jedis jedisToPause1 = createJedisDefaultTimeout();
final Jedis jedisToPause2 = createJedisDefaultTimeout();

int pauseMillis = 1250;
int pauseMillis = 600;
jedis.clientPause(pauseMillis);

Future<Long> latency1 = executorService.submit(new Callable<Long>() {
Expand Down Expand Up @@ -265,11 +265,11 @@ public Long call() throws Exception {

@Test
public void clientPauseAll() throws InterruptedException, ExecutionException {
final int pauseMillis = 1250;
final int pauseMillis = 600;
final int pauseMillisDelta = 100;

ExecutorService executorService = Executors.newFixedThreadPool(1);
try (Jedis jedisPause = createJedis()) {
try (Jedis jedisPause = createJedisDefaultTimeout();) {

jedis.clientPause(pauseMillis, ClientPauseMode.ALL);

Expand All @@ -295,11 +295,11 @@ public Long call() throws Exception {

@Test
public void clientPauseWrite() throws InterruptedException, ExecutionException {
final int pauseMillis = 1250;
final int pauseMillis = 600;
final int pauseMillisDelta = 100;

ExecutorService executorService = Executors.newFixedThreadPool(2);
try (Jedis jedisRead = createJedis(); Jedis jedisWrite = createJedis();) {
try (Jedis jedisRead = createJedisDefaultTimeout(); Jedis jedisWrite = createJedisDefaultTimeout();) {

jedis.clientPause(pauseMillis, ClientPauseMode.WRITE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,8 @@ public void tearDown() throws Exception {
protected Jedis createJedis() {
return new Jedis(hnp, config);
}

protected Jedis createJedisDefaultTimeout() {
return new Jedis(hnp, DefaultJedisClientConfig.builder().password("foobared").build());
}
}

0 comments on commit d2b46ba

Please sign in to comment.