mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-28 14:47:16 +00:00
save
This commit is contained in:
parent
55080d5c01
commit
d4b9053aed
@ -13,9 +13,11 @@ import (
|
|||||||
grpc_recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery"
|
grpc_recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/backoff"
|
"google.golang.org/grpc/backoff"
|
||||||
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/credentials"
|
"google.golang.org/grpc/credentials"
|
||||||
"google.golang.org/grpc/keepalive"
|
"google.golang.org/grpc/keepalive"
|
||||||
"google.golang.org/grpc/reflection"
|
"google.golang.org/grpc/reflection"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TLS(tlsCACert, tlsCertFile, tlsKeyFile string) (credentials.TransportCredentials, error) {
|
func TLS(tlsCACert, tlsCertFile, tlsKeyFile string) (credentials.TransportCredentials, error) {
|
||||||
@ -112,3 +114,11 @@ func Connect(creds credentials.TransportCredentials, dialAddress string) (*grpc.
|
|||||||
|
|
||||||
return grpc.DialContext(ctx, dialAddress, dialOpts...)
|
return grpc.DialContext(ctx, dialAddress, dialOpts...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IsRetryLater(err error) bool {
|
||||||
|
if s, ok := status.FromError(err); ok {
|
||||||
|
code := s.Code()
|
||||||
|
return code == codes.Unavailable || code == codes.Canceled || code == codes.ResourceExhausted
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user