public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager] schedule-analyze: fix schedules with limited runs
@ 2022-05-03 14:10 Dominik Csapak
  2022-05-04  5:15 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2022-05-03 14:10 UTC (permalink / raw)
  To: pve-devel

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 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/PVE/API2/Cluster/Jobs.pm b/PVE/API2/Cluster/Jobs.pm
index 2699442a..8166333d 100644
--- a/PVE/API2/Cluster/Jobs.pm
+++ b/PVE/API2/Cluster/Jobs.pm
@@ -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)),
-- 
2.30.2





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH manager] schedule-analyze: fix schedules with limited runs
  2022-05-03 14:10 [pve-devel] [PATCH manager] schedule-analyze: fix schedules with limited runs Dominik Csapak
@ 2022-05-04  5:15 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2022-05-04  5:15 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dominik Csapak

Am 5/3/22 um 16:10 schrieb Dominik Csapak:
> 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 | 1 +
>  1 file changed, 1 insertion(+)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-04  5:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-03 14:10 [pve-devel] [PATCH manager] schedule-analyze: fix schedules with limited runs Dominik Csapak
2022-05-04  5:15 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal