Update to embedded-redis 0.9.1
This commit is contained in:
parent
93b7fd589e
commit
c6843c1eae
2
pom.xml
2
pom.xml
|
@ -266,7 +266,7 @@
|
|||
<dependency>
|
||||
<groupId>org.signal</groupId>
|
||||
<artifactId>embedded-redis</artifactId>
|
||||
<version>0.9.0</version>
|
||||
<version>0.9.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.junit.jupiter.api.extension.ExtensionContext;
|
|||
import org.whispersystems.textsecuregcm.configuration.CircuitBreakerConfiguration;
|
||||
import org.whispersystems.textsecuregcm.configuration.RetryConfiguration;
|
||||
import redis.embedded.RedisServer;
|
||||
import redis.embedded.exceptions.EmbeddedRedisException;
|
||||
|
||||
public class RedisServerExtension implements BeforeAllCallback, BeforeEachCallback, AfterAllCallback, AfterEachCallback {
|
||||
|
||||
|
@ -52,7 +53,7 @@ public class RedisServerExtension implements BeforeAllCallback, BeforeEachCallba
|
|||
.port(getAvailablePort())
|
||||
.build();
|
||||
|
||||
redisServer.start();
|
||||
startWithRetries(3);
|
||||
}
|
||||
|
||||
public static RedisURI getRedisURI() {
|
||||
|
@ -96,4 +97,16 @@ public class RedisServerExtension implements BeforeAllCallback, BeforeEachCallba
|
|||
return socket.getLocalPort();
|
||||
}
|
||||
}
|
||||
|
||||
private void startWithRetries(int attemptsLeft) throws Exception {
|
||||
try {
|
||||
redisServer.start();
|
||||
} catch (final EmbeddedRedisException e) {
|
||||
if (attemptsLeft == 0) {
|
||||
throw e;
|
||||
}
|
||||
Thread.sleep(500);
|
||||
startWithRetries(attemptsLeft - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue