Improve Redis exception handling

This commit is contained in:
Jon Chambers
2021-09-22 10:31:39 -04:00
committed by GitHub
parent 6a71d369e2
commit 98e41f9a37
12 changed files with 49 additions and 407 deletions

View File

@@ -18,7 +18,6 @@ import org.slf4j.LoggerFactory;
import org.whispersystems.textsecuregcm.push.ApnMessage.Type;
import org.whispersystems.textsecuregcm.redis.ClusterLuaScript;
import org.whispersystems.textsecuregcm.redis.FaultTolerantRedisCluster;
import org.whispersystems.textsecuregcm.redis.RedisException;
import org.whispersystems.textsecuregcm.storage.Account;
import org.whispersystems.textsecuregcm.storage.AccountsManager;
import org.whispersystems.textsecuregcm.storage.Device;
@@ -135,27 +134,19 @@ public class ApnFallbackManager implements Managed {
}
}
public void schedule(Account account, Device device) throws RedisException {
public void schedule(Account account, Device device) {
schedule(account, device, System.currentTimeMillis());
}
@VisibleForTesting
void schedule(Account account, Device device, long timestamp) throws RedisException {
try {
sent.mark();
insert(account, device, timestamp + (15 * 1000), (15 * 1000));
} catch (io.lettuce.core.RedisException e) {
throw new RedisException(e);
}
void schedule(Account account, Device device, long timestamp) {
sent.mark();
insert(account, device, timestamp + (15 * 1000), (15 * 1000));
}
public void cancel(Account account, Device device) throws RedisException {
try {
if (remove(account, device)) {
delivered.mark();
}
} catch (io.lettuce.core.RedisException e) {
throw new RedisException(e);
public void cancel(Account account, Device device) {
if (remove(account, device)) {
delivered.mark();
}
}