From de80a09223de2ff50804c45a8bb8b52bca298c6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 19 Jul 2022 18:40:22 +0200 Subject: [PATCH] Manager: include job UUID in "last-rendered image received" log entries This makes it possible to collect all "last-rendered image received" entries for a single job. --- internal/manager/api_impl/workers.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/internal/manager/api_impl/workers.go b/internal/manager/api_impl/workers.go index 9363df81..56c145c6 100644 --- a/internal/manager/api_impl/workers.go +++ b/internal/manager/api_impl/workers.go @@ -404,6 +404,10 @@ func (f *Flamenco) TaskOutputProduced(e echo.Context, taskID string) error { panic("task could not be fetched, but database gave no error either") } + // Include the job UUID in the logger. + jobUUID := dbTask.Job.UUID + logger = logger.With().Str("job", jobUUID).Logger() + // Read the image bytes into memory. imageBytes, err := io.ReadAll(e.Request().Body) if err != nil { @@ -412,7 +416,6 @@ func (f *Flamenco) TaskOutputProduced(e echo.Context, taskID string) error { } // Create the "last rendered" payload. - jobUUID := dbTask.Job.UUID thumbnailInfo, err := f.lastRenderedInfoForJob(logger, jobUUID) if err != nil { logger.Error().Err(err).Msg("TaskOutputProduced: error getting last-rendered thumbnail info for job") @@ -426,7 +429,10 @@ func (f *Flamenco) TaskOutputProduced(e echo.Context, taskID string) error { Callback: func(ctx context.Context) { // Store this job as the last one to get a rendered image. - f.persist.SetLastRendered(ctx, dbTask.Job) + err := f.persist.SetLastRendered(ctx, dbTask.Job) + if err != nil { + logger.Error().Err(err).Msg("TaskOutputProduced: error marking this job as the last one to receive render output") + } // Broadcast when the processing is done. update := webupdates.NewLastRenderedUpdate(jobUUID)