mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
migrate from java.util.Date to java.time
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
package com.commafeed.backend.task;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
|
||||
import com.commafeed.CommaFeedConfiguration;
|
||||
import com.commafeed.backend.service.DatabaseCleaningService;
|
||||
|
||||
@@ -23,7 +22,7 @@ public class OldEntriesCleanupTask extends ScheduledTask {
|
||||
public void run() {
|
||||
int maxAgeDays = config.getApplicationSettings().getMaxEntriesAgeDays();
|
||||
if (maxAgeDays > 0) {
|
||||
Date threshold = DateUtils.addDays(new Date(), -1 * maxAgeDays);
|
||||
Instant threshold = Instant.now().minus(Duration.ofDays(maxAgeDays));
|
||||
cleaner.cleanEntriesOlderThan(threshold);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.commafeed.backend.task;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.Instant;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.commafeed.CommaFeedConfiguration;
|
||||
@@ -19,7 +19,7 @@ public class OldStatusesCleanupTask extends ScheduledTask {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Date threshold = config.getApplicationSettings().getUnreadThreshold();
|
||||
Instant threshold = config.getApplicationSettings().getUnreadThreshold();
|
||||
if (threshold != null) {
|
||||
cleaner.cleanStatusesOlderThan(threshold);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user