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:
parent
d114f3646d
commit
bd2b7d2b32
1 changed files with 5 additions and 1 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue