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).
This commit is contained in:
Alexis Mousset 2017-01-09 14:08:34 +01:00 committed by GitHub
parent 654ecf5e54
commit b8a9b6fa8a

View File

@ -29,10 +29,12 @@ $call_interval = get_cli_option('call-interval', $options);
foreach (Model\User\get_all_users() as $user) { foreach (Model\User\get_all_users() as $user) {
if ($update_interval !== null && $call_interval !== null && $limit === null && $update_interval >= $call_interval) { if ($update_interval !== null && $call_interval !== null && $limit === null && $update_interval >= $call_interval) {
$feeds_count = Model\Feed\count_feeds($user['id']); $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_read($user['id']);
Model\Item\autoflush_unread($user['id']); Model\Item\autoflush_unread($user['id']);
Miniflux\Helper\write_debug_file(); Miniflux\Helper\write_debug_file();