Delete migrated stores after closing the input stream

Fixes #1018
This commit is contained in:
AsamK committed 2022-10-03 13:38:41 +02:00
1 parent 5b5827f885
commit 333aacf4ab
2 files changed
+10 -1

No files matched your search

@@ -84,13 +84,18 @@ public class LegacyRecipientStore2 {
}).collect(Collectors.toMap(Recipient::getRecipientId, r -> r));
recipientStore.addLegacyRecipients(recipients);
Files.delete(file.toPath());
} catch (FileNotFoundException e) {
// nothing to migrate
} catch (IOException e) {
logger.warn("Failed to load recipient store", e);
throw new RuntimeException(e);
}
try {
Files.delete(file.toPath());
} catch (IOException e) {
logger.warn("Failed to load recipient store", e);
throw new RuntimeException(e);
}
}
private record Storage(List<Recipient> recipients, long lastId) {
@@ -52,6 +52,10 @@ public class LegacySenderKeySharedStore {
}
senderKeyStore.addLegacySenderKeysShared(sharedSenderKeys);
} catch (IOException e) {
logger.info("Failed to load shared sender key store, ignoring", e);
}
try {
Files.delete(file.toPath());
} catch (IOException e) {
logger.info("Failed to load shared sender key store, ignoring", e);