Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit the max nextUpdateTime delay to 24 hour #3074

Merged
merged 1 commit into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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