]> git.proxmox.com Git - pve-manager.git/commitdiff
schedule-analyze: fix schedules with limited runs
authorDominik Csapak <d.csapak@proxmox.com>
Tue, 3 May 2022 14:10:25 +0000 (16:10 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 4 May 2022 05:10:13 +0000 (07:10 +0200)
When a schedule only has a limited amount of runs it can happen
(e.g. 2022-10-01 8:00/30), $next will be undef after the last run.
Exit early in that case.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
PVE/API2/Cluster/Jobs.pm

index 2699442a76a17b7df37bd794b6243f2fa76008ac..8166333dcf5ea395b6bec16a33577d2cb8c082a3 100644 (file)
@@ -97,6 +97,7 @@ __PACKAGE__->register_method({
 
        for (my $count = 0; $count < $iterations; $count++) {
            my $next = PVE::CalendarEvent::compute_next_event($event, $starttime);
+           last if !defined($next);
            push @$result, {
                timestamp => $next,
                utc => scalar(gmtime($next)),