Skip to content

Commit

Permalink
fix: set the duration after which a feed is considered sleepy to 7 da…
Browse files Browse the repository at this point in the history
…ys and limit the time to the next update to a maximum of 24 hours

Signed-off-by: Wolfgang <[email protected]>
  • Loading branch information
wofferl authored and Grotax committed Jan 30, 2025
1 parent d3719e8 commit a646552
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ You can also check [on GitHub](https://github.com/nextcloud/news/releases), the
## [25.x.x]
### Changed
- Set mobileLayout to `horizontal-split` and add nav buttons for articles in mobile view
- set the duration after which a feed is considered sleepy to 7 days when using `nextUpdateTime`
- limit the time to the next update to a maximum of 24 hours when using `nextUpdateTime`

### Fixed
- Show error on folders only if at least one feed has more than eight errors

Expand Down
2 changes: 1 addition & 1 deletion docs/admin.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ The new value is only applied after the next run of the updater.

Starting with News 25.2.0, the app can dynamically adjust update schedules based on feed activity. This feature, disabled by default, can be enabled by the Nextcloud administrator.

By analyzing feed data, the app can optimize update frequencies, potentially reducing server load and network traffic. However, this feature may not work correctly with all feeds.
By analyzing feed data, the app can optimize update frequencies, potentially reducing server load and network traffic. The time until the next calculated update point is limited to a maximum of 24 hours. However, this feature may not work correctly with all feeds.

Users can check the calculated next update time in the app's settings. This information will only be displayed when the dynamic update scheduling feature is enabled.
2 changes: 1 addition & 1 deletion lib/Config/FetcherConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class FetcherConfig
* Duration after which the feed is considered sleepy.
* @var int
*/
public const SLEEPY_DURATION = 86400;
public const SLEEPY_DURATION = 7 * 86400;

/**
* Logger
Expand Down
5 changes: 3 additions & 2 deletions lib/Fetcher/FeedFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,10 @@ public function fetch(
$location
);

$feed->setNextUpdateTime(nextUpdateTime: $resource->getNextUpdate(
// Set the next calculated update time, but maximum 24 hours from now
$feed->setNextUpdateTime(nextUpdateTime: min($resource->getNextUpdate(
sleepyDuration: $this->fetcherConfig::SLEEPY_DURATION
)?->getTimestamp());
)?->getTimestamp(), time() + 86400));

$this->logger->debug(
'Feed {url} was parsed and nextUpdateTime is {nextUpdateTime}',
Expand Down

0 comments on commit a646552

Please sign in to comment.