From d985f3ffce4cb05da7051d0bc93bb38f57c866b7 Mon Sep 17 00:00:00 2001 From: Benjamin Brahmer Date: Tue, 31 Dec 2024 12:48:17 +0100 Subject: [PATCH] add SLEEPY_DURATION to FethcerConfig and use it for the nextUpdateTime calculation Signed-off-by: Benjamin Brahmer --- lib/Config/FetcherConfig.php | 6 ++++++ lib/Fetcher/FeedFetcher.php | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/Config/FetcherConfig.php b/lib/Config/FetcherConfig.php index d0da1da6a..7a8fa494f 100644 --- a/lib/Config/FetcherConfig.php +++ b/lib/Config/FetcherConfig.php @@ -67,6 +67,12 @@ class FetcherConfig 'application/atom+xml;q=0.6, application/xml;q=0.4, ' . 'text/xml;q=0.4, */*;q=0.2'; + /** + * Duration after which the feed is considered sleepy. + * @var int + */ + public const SLEEPY_DURATION = 86400; + /** * FetcherConfig constructor. * diff --git a/lib/Fetcher/FeedFetcher.php b/lib/Fetcher/FeedFetcher.php index b8e1ab81e..a63b58a6d 100755 --- a/lib/Fetcher/FeedFetcher.php +++ b/lib/Fetcher/FeedFetcher.php @@ -145,7 +145,11 @@ public function fetch( $location ); - $feed->setNextUpdateTime($resource->getNextUpdate()?->getTimestamp()); + $feed->setNextUpdateTime(nextUpdateTime: $resource->getNextUpdate( + sleepyDuration: $this->fetcherConfig::SLEEPY_DURATION + )?->getTimestamp() + ); + $this->logger->debug( 'Feed {url} was parsed and nextUpdateTime is {nextUpdateTime}', [