Skip to content

Commit

Permalink
Allow different limits for users in cronjob
Browse files Browse the repository at this point in the history
When using update_interval and call_interval, the limit computed for the first user is used for all other users (which, when the first user is admin and has no feeds, breaks the update).
  • Loading branch information
amousset authored Jan 9, 2017
1 parent 654ecf5 commit b8a9b6f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cronjob.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@
foreach (Model\User\get_all_users() as $user) {
if ($update_interval !== null && $call_interval !== null && $limit === null && $update_interval >= $call_interval) {
$feeds_count = Model\Feed\count_feeds($user['id']);
$limit = ceil($feeds_count / ($update_interval / $call_interval));
$current_limit = ceil($feeds_count / ($update_interval / $call_interval));
} else {
$current_limit = $limit;
}

Handler\Feed\update_feeds($user['id'], $limit);
Handler\Feed\update_feeds($user['id'], $current_limit);
Model\Item\autoflush_read($user['id']);
Model\Item\autoflush_unread($user['id']);
Miniflux\Helper\write_debug_file();
Expand Down

0 comments on commit b8a9b6f

Please sign in to comment.