1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-09-05 18:40:59 +00:00

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.
This commit is contained in:
Earl Warren 2025-08-16 19:25:50 +02:00
parent d114f3646d
commit bd2b7d2b32
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -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,