From b66b848a63ad8583c2c47e0a359af6ded8bda7b0 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sun, 23 Jul 2023 21:49:33 +0000 Subject: [PATCH] fix(coderd/unhanger): de-duplicate logs The final warning just repeated previous lines. --- coderd/unhanger/detector.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/coderd/unhanger/detector.go b/coderd/unhanger/detector.go index fb81311664984..4015bf4d3f90d 100644 --- a/coderd/unhanger/detector.go +++ b/coderd/unhanger/detector.go @@ -140,9 +140,6 @@ func (d *Detector) Start() { if stats.Error != nil && !xerrors.As(stats.Error, &acquireLockError{}) { d.log.Warn(d.ctx, "error running workspace build hang detector once", slog.Error(stats.Error)) } - if len(stats.TerminatedJobIDs) != 0 { - d.log.Warn(d.ctx, "detected (and terminated) hung provisioner jobs", slog.F("job_ids", stats.TerminatedJobIDs)) - } if d.stats != nil { select { case <-d.ctx.Done(): @@ -251,7 +248,10 @@ func unhangJob(ctx context.Context, log slog.Logger, db database.Store, pub pubs } } - log.Info(ctx, "detected hung (>5m) provisioner job, forcefully terminating") + log.Warn( + ctx, "detected hung provisioner job, forcefully terminating", + "threshold", HungJobDuration, + ) // First, get the latest logs from the build so we can make sure // our messages are in the latest stage.