Gracefully handle NotPushRegisteredException

This commit is contained in:
Jon Chambers
2024-06-25 11:23:16 -04:00
committed by GitHub
parent 2619569549
commit cb5cd64c05
7 changed files with 66 additions and 154 deletions

View File

@@ -52,8 +52,7 @@ public class MessageSender {
this.pushLatencyManager = pushLatencyManager;
}
public void sendMessage(final Account account, final Device device, final Envelope message, final boolean online)
throws NotPushRegisteredException {
public void sendMessage(final Account account, final Device device, final Envelope message, final boolean online) {
final String channel;
@@ -64,7 +63,7 @@ public class MessageSender {
} else if (device.getFetchesMessages()) {
channel = "websocket";
} else {
throw new AssertionError();
channel = "none";
}
final boolean clientPresent;
@@ -89,10 +88,7 @@ public class MessageSender {
final boolean useVoip = StringUtils.isNotBlank(device.getVoipApnId());
RedisOperation.unchecked(() -> pushLatencyManager.recordPushSent(account.getUuid(), device.getId(), useVoip, message.getUrgent()));
} catch (final NotPushRegisteredException e) {
if (!device.getFetchesMessages()) {
throw e;
}
} catch (final NotPushRegisteredException ignored) {
}
}
}

View File

@@ -55,8 +55,6 @@ public class ReceiptSender {
for (final Device destinationDevice : destinationAccount.getDevices()) {
try {
messageSender.sendMessage(destinationAccount, destinationDevice, message.build(), false);
} catch (final NotPushRegisteredException e) {
logger.debug("User no longer push registered for delivery receipt: {}", e.getMessage());
} catch (final Exception e) {
logger.warn("Could not send delivery receipt", e);
}