1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-09-15 18:57:01 +00:00

fix: use accessors on protobuf messages instead of struct members (#684)

So it does not panic if one is nil.

Closes forgejo/runner#146

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/684
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
This commit is contained in:
Earl Warren 2025-07-11 07:10:41 +00:00 committed by earl-warren
parent 90a12ccd80
commit 5e3cb5468c
No known key found for this signature in database
GPG key ID: F128CBE6AB3A7201
8 changed files with 21 additions and 21 deletions

View file

@ -315,7 +315,7 @@ func (r *Reporter) ReportLog(noMore bool) error {
return err
}
ack := int(resp.Msg.AckIndex)
ack := int(resp.Msg.GetAckIndex())
if ack < r.logOffset {
return fmt.Errorf("submitted logs are lost %d < %d", ack, r.logOffset)
}
@ -356,11 +356,11 @@ func (r *Reporter) ReportState() error {
return err
}
for _, k := range resp.Msg.SentOutputs {
for _, k := range resp.Msg.GetSentOutputs() {
r.outputs.Store(k, struct{}{})
}
if resp.Msg.State != nil && resp.Msg.State.Result == runnerv1.Result_RESULT_CANCELLED {
if resp.Msg.GetState().GetResult() == runnerv1.Result_RESULT_CANCELLED {
r.cancel()
}