From b9ce115a3d0bbd010df219c7262aeecfa5b8e6b6 Mon Sep 17 00:00:00 2001 From: espie Date: Thu, 24 Oct 2019 15:05:22 +0000 Subject: [PATCH] make the JUNKING log entries "silent" so they don't change frozen status nor interfere with stuck_timeout problem noticed by sthen@ --- infrastructure/lib/DPB/Clock.pm | 10 +++++++++- infrastructure/lib/DPB/Job/Port.pm | 22 +++++++++++++++++----- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/infrastructure/lib/DPB/Clock.pm b/infrastructure/lib/DPB/Clock.pm index 9733ab5ecab..fad3ebbb49b 100644 --- a/infrastructure/lib/DPB/Clock.pm +++ b/infrastructure/lib/DPB/Clock.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Clock.pm,v 1.15 2019/09/28 12:22:12 espie Exp $ +# $OpenBSD: Clock.pm,v 1.16 2019/10/24 15:05:22 espie Exp $ # # Copyright (c) 2011-2013 Marc Espie # @@ -130,6 +130,14 @@ sub check_change return $d; } +sub adjust_by +{ + my ($self, $l) = @_; + if (defined $self->{sz}) { + $self->{sz} += $l; + } +} + sub percent_message { my $self = shift; diff --git a/infrastructure/lib/DPB/Job/Port.pm b/infrastructure/lib/DPB/Job/Port.pm index 6bc17f96d01..15391095580 100644 --- a/infrastructure/lib/DPB/Job/Port.pm +++ b/infrastructure/lib/DPB/Job/Port.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Port.pm,v 1.197 2019/10/23 10:09:50 espie Exp $ +# $OpenBSD: Port.pm,v 1.198 2019/10/24 15:05:22 espie Exp $ # # Copyright (c) 2010-2013 Marc Espie # @@ -700,9 +700,9 @@ sub run if (!$core->prop->{silentjunking}) { for my $j ($core->same_host_jobs) { next if $j eq $job; - print {$j->{logfh}} + $j->silent_log( ">> JUNKING in $job->{path}:\n", - ">> $s"; + ">> $s"); } } @@ -723,8 +723,8 @@ sub finalize if (!$core->prop->{silentjunking}) { for my $j ($core->same_host_jobs) { next if $j eq $job; - print {$j->{logfh}} - ">> JUNKING end in $job->{path}\n"; + $j->silent_log( + ">> JUNKING end in $job->{path}\n"); } } $core->prop->{last_junk} = $job->{v}; @@ -1200,6 +1200,18 @@ sub new return $job; } +sub silent_log +{ + my $job = shift; + my $msg = join(@_); + my $old = $job->{logfh}->autoflush(1); + print {$job->{logfh}} $msg; + $job->{logfh}->autoflush($old); + if (defined $job->{watched}) { + $job->{watched}->adjust_by(length($msg)); + } +} + sub new_junk_only { my $class = shift;