Skip to content

Commit

Permalink
add SLEEPY_DURATION to FethcerConfig and use it for the nextUpdateTim…
Browse files Browse the repository at this point in the history
…e calculation

Signed-off-by: Benjamin Brahmer <[email protected]>
  • Loading branch information
Grotax committed Dec 31, 2024
1 parent 265f67a commit 9ca0bfd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/Config/FetcherConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
5 changes: 4 additions & 1 deletion lib/Fetcher/FeedFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ 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}',
[
Expand Down

0 comments on commit 9ca0bfd

Please sign in to comment.