From bd2b7d2b32beba4e9cef6f16fa3fae323686fea4 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Sat, 16 Aug 2025 19:25:50 +0200 Subject: [PATCH] fix: after canceling the context, the reporter cannot communicate ctx & cancel are related and when cancel is called, the context is no longer usable. Use the daemon context context to allow the reporter to continue to operate and conclude the converation with the Forgejo instance. --- internal/pkg/report/reporter.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/pkg/report/reporter.go b/internal/pkg/report/reporter.go index 2545faf3..ed7e81a4 100644 --- a/internal/pkg/report/reporter.go +++ b/internal/pkg/report/reporter.go @@ -20,6 +20,7 @@ import ( "google.golang.org/protobuf/types/known/timestamppb" "code.forgejo.org/forgejo/runner/v9/internal/pkg/client" + "code.forgejo.org/forgejo/runner/v9/internal/pkg/common" ) var ( @@ -61,7 +62,10 @@ func NewReporter(ctx context.Context, cancel context.CancelFunc, c client.Client } rv := &Reporter{ - ctx: ctx, + // ctx & cancel are related: the daemon context allows the reporter + // to continue to operate even after the context is canceled, to + // conclude the converation + ctx: common.DaemonContext(ctx), cancel: cancel, client: c, masker: masker,