From 270ad22c79be055f384a520fc4b201727f0964eb Mon Sep 17 00:00:00 2001 From: Brandon Sakai Date: Fri, 9 Jun 2023 13:33:39 +0000 Subject: [PATCH] Combine redundant if in graceful shutdown path --- lib/Mojo/Server/Prefork.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Mojo/Server/Prefork.pm b/lib/Mojo/Server/Prefork.pm index 04f8bc459b..9935d9819b 100644 --- a/lib/Mojo/Server/Prefork.pm +++ b/lib/Mojo/Server/Prefork.pm @@ -181,8 +181,10 @@ sub _wait { while ($chunk =~ /(\d+):(\d)\n/g) { next unless my $w = $self->{pool}{$1}; @$w{qw(healthy time)} = (1, $time) and $self->emit(heartbeat => $1); - $w->{graceful} ||= $time if $2; - $w->{quit}++ if $2; + if($2) { + $w->{graceful} ||= $time; + $w->{quit}++; + } } }