public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pmg-devel] [PATCH pmg-api] pmg-daily: avoid short-circuting update of local channels
@ 2022-07-12 12:14 Stoiko Ivanov
  2022-07-13  6:58 ` Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Stoiko Ivanov @ 2022-07-12 12:14 UTC (permalink / raw)
  To: pmg-devel

by using ||= directly with the actual update call as operand, it does
not get run, if `sa-update` already returned that a restart is needed.

reported in our community forum:
https://forum.proxmox.com/threads/.112112/

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 src/bin/pmg-daily | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/bin/pmg-daily b/src/bin/pmg-daily
index b06515c..a9bfd1c 100755
--- a/src/bin/pmg-daily
+++ b/src/bin/pmg-daily
@@ -85,7 +85,8 @@ if (system('sa-update') == 0) {
 }
 
 eval {
-    $restart_filter ||= PMG::Utils::update_local_spamassassin_channels(0);
+    my $res ||= PMG::Utils::update_local_spamassassin_channels(0);
+    $restart_filter ||= $res;
 };
 syslog('err', "$@") if $@;
 
-- 
2.30.2





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

* Re: [pmg-devel] [PATCH pmg-api] pmg-daily: avoid short-circuting update of local channels
  2022-07-12 12:14 [pmg-devel] [PATCH pmg-api] pmg-daily: avoid short-circuting update of local channels Stoiko Ivanov
@ 2022-07-13  6:58 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2022-07-13  6:58 UTC (permalink / raw)
  To: Stoiko Ivanov, pmg-devel

Am 12/07/2022 um 14:14 schrieb Stoiko Ivanov:
> by using ||= directly with the actual update call as operand, it does
> not get run, if `sa-update` already returned that a restart is needed.
> 
> reported in our community forum:
> https://forum.proxmox.com/threads/.112112/
> 
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
>  src/bin/pmg-daily | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/bin/pmg-daily b/src/bin/pmg-daily
> index b06515c..a9bfd1c 100755
> --- a/src/bin/pmg-daily
> +++ b/src/bin/pmg-daily
> @@ -85,7 +85,8 @@ if (system('sa-update') == 0) {
>  }
>  
>  eval {
> -    $restart_filter ||= PMG::Utils::update_local_spamassassin_channels(0);
> +    my $res ||= PMG::Utils::update_local_spamassassin_channels(0);

||= makes not much sense for a newly declared variable, just use plain assignment please.

Alternatively you could also just do:

$restart_filter = 1 if PMG::Utils::update_local_spamassassin_channels(0);
 

> +    $restart_filter ||= $res;
>  };
>  syslog('err', "$@") if $@;
>  





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

end of thread, other threads:[~2022-07-13  6:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-12 12:14 [pmg-devel] [PATCH pmg-api] pmg-daily: avoid short-circuting update of local channels Stoiko Ivanov
2022-07-13  6:58 ` 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