Fix backup scheduling looping bug.

main
Cody Henthorne 2023-02-07 11:12:59 -05:00 zatwierdzone przez Alex Hart
rodzic 89b0167fd2
commit 6c78a405bb
1 zmienionych plików z 5 dodań i 5 usunięć

Wyświetl plik

@ -49,11 +49,11 @@ public class LocalBackupListener extends PersistentAlarmManagerListener {
if (Build.VERSION.SDK_INT < 31) { if (Build.VERSION.SDK_INT < 31) {
nextTime = System.currentTimeMillis() + INTERVAL; nextTime = System.currentTimeMillis() + INTERVAL;
} else { } else {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
int hour = SignalStore.settings().getBackupHour(); int hour = SignalStore.settings().getBackupHour();
int minute = SignalStore.settings().getBackupMinute(); int minute = SignalStore.settings().getBackupMinute();
LocalDateTime next = now.withHour(hour).withMinute(minute).withSecond(0); LocalDateTime next = now.withHour(hour).withMinute(minute).withSecond(0);
if (now.getHour() >= 2) { if (now.isAfter(next)) {
next = next.plusDays(1); next = next.plusDays(1);
} }