From b8a9b6fa8af8598c04823636b968d4d2e174dbc1 Mon Sep 17 00:00:00 2001 From: Alexis Mousset Date: Mon, 9 Jan 2017 14:08:34 +0100 Subject: [PATCH] Allow different limits for users in cronjob 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). --- cronjob.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cronjob.php b/cronjob.php index a646e6f..4b7e114 100644 --- a/cronjob.php +++ b/cronjob.php @@ -29,10 +29,12 @@ $call_interval = get_cli_option('call-interval', $options); 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();