mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-24 05:18:58 +00:00
(feed) Wipe the feeds db and start over from system URLs periodically.
This commit is contained in:
parent
b8e0dc93d7
commit
a293266ccd
@ -24,6 +24,7 @@ import java.io.IOException;
|
|||||||
import java.net.http.HttpClient;
|
import java.net.http.HttpClient;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
@ -89,7 +90,12 @@ public class FeedFetcherService {
|
|||||||
// RSS exports instead
|
// RSS exports instead
|
||||||
|
|
||||||
Collection<FeedDefinition> definitions = feedDb.getAllFeeds();
|
Collection<FeedDefinition> definitions = feedDb.getAllFeeds();
|
||||||
if (definitions == null) {
|
|
||||||
|
// If we didn't get any definitions, or approximately every other month, read them from the system
|
||||||
|
// to get the latest feeds. As the feeds known by the system have a lot of dead links, we don't
|
||||||
|
// want to do this too often.
|
||||||
|
final LocalDate today = LocalDate.now();
|
||||||
|
if (definitions == null || (today.getDayOfMonth() == 1 && (today.getMonthValue() % 2) == 0)) {
|
||||||
definitions = readDefinitionsFromSystem();
|
definitions = readDefinitionsFromSystem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user