make gRPC error "to many keepalive pings" only show up in trace logs (#787)

hotfix #717

This comes from the agent being inactive / not sending and requesting any data if there a no pipelines waiting for him to execute. GRPC seems to only allow 2 pings without calling an actual endpoint before closing the connection. I think this will be indirectly solved in the moment we implement something like #536

https://github.com/grpc/grpc/blob/master/doc/keepalive.md

Co-authored-by: Anbraten <anton@ju60.de>
This commit is contained in:
6543 2022-02-24 15:53:44 +01:00 committed by GitHub
parent f97f6f25b3
commit 505cf8c09a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,6 +3,7 @@ package rpc
import (
"context"
"encoding/json"
"strings"
"time"
"github.com/rs/zerolog/log"
@ -46,7 +47,13 @@ func (c *client) Next(ctx context.Context, f Filter) (*Pipeline, error) {
if err == nil {
break
} else {
log.Err(err).Msgf("grpc error: done(): code: %v: %s", status.Code(err), err)
// TODO: remove after adding continuous data exchange by something like #536
if strings.Contains(err.Error(), "\"too_many_pings\"") {
// https://github.com/woodpecker-ci/woodpecker/issues/717#issuecomment-1049365104
log.Trace().Err(err).Msg("grpc: to many keepalive pings without sending data")
} else {
log.Err(err).Msgf("grpc error: done(): code: %v: %s", status.Code(err), err)
}
}
switch status.Code(err) {
case