daemon: terminate_server reduce code reuse
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 10 Nov 2017 11:09:29 +0000 (12:09 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 10 Nov 2017 11:14:20 +0000 (12:14 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/Daemon.pm

index 55a03fc..d7f9a27 100644 (file)
@@ -192,15 +192,10 @@ my $terminate_server = sub {
 
     $self->{terminate} = 1; # set flag to avoid worker restart
 
-    if (!$self->{max_workers}) {
-       eval { $self->shutdown(); };
-       warn $@ if $@;
-       return;
-    }
-
     eval { $self->shutdown(); };
     warn $@ if $@;
 
+    return if !$self->{max_workers}; # if we have no workers we're done here
 
     # if configured, leave children running on HUP
     return if $allow_open_children && $self->{leave_children_open_on_reload};