Fix truncating cdsi table

Fixes #1587
This commit is contained in:
AsamK 2024-09-12 23:09:20 +02:00
parent 352699c4b6
commit c6e93126fa
2 changed files with 3 additions and 2 deletions

View file

@ -14,6 +14,7 @@ import org.whispersystems.signalservice.api.push.ServiceId;
import org.whispersystems.signalservice.api.push.ServiceId.ACI; import org.whispersystems.signalservice.api.push.ServiceId.ACI;
import org.whispersystems.signalservice.api.push.ServiceId.PNI; import org.whispersystems.signalservice.api.push.ServiceId.PNI;
import org.whispersystems.signalservice.api.push.SignalServiceAddress; import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import org.whispersystems.signalservice.api.push.exceptions.CdsiInvalidArgumentException;
import org.whispersystems.signalservice.api.push.exceptions.CdsiInvalidTokenException; import org.whispersystems.signalservice.api.push.exceptions.CdsiInvalidTokenException;
import org.whispersystems.signalservice.api.services.CdsiV2Service; import org.whispersystems.signalservice.api.services.CdsiV2Service;
@ -254,7 +255,7 @@ public class RecipientHelper {
account.setLastRecipientsRefresh(System.currentTimeMillis()); account.setLastRecipientsRefresh(System.currentTimeMillis());
} }
}); });
} catch (CdsiInvalidTokenException e) { } catch (CdsiInvalidTokenException | CdsiInvalidArgumentException e) {
account.setCdsiToken(null); account.setCdsiToken(null);
account.getCdsiStore().clearAll(); account.getCdsiStore().clearAll();
throw e; throw e;

View file

@ -156,7 +156,7 @@ public class CdsiStore {
public void clearAll() { public void clearAll() {
final var sql = ( final var sql = (
""" """
TRUNCATE %s DELETE FROM %s
""" """
).formatted(TABLE_CDSI); ).formatted(TABLE_CDSI);
try (final var connection = database.getConnection()) { try (final var connection = database.getConnection()) {