go-utils: github.com/TheThingsNetwork/go-utils/grpc/restartstream Index | Files

package restartstream

import "github.com/TheThingsNetwork/go-utils/grpc/restartstream"

Index

Package Files

restart.go

Variables

var DefaultSettings = Settings{
    RetryableCodes: []codes.Code{
        codes.Canceled,
        codes.Unknown,
        codes.DeadlineExceeded,
        codes.Aborted,
        codes.Unavailable,
    },
    Backoff: backoff.DefaultConfig,
}

DefaultSettings for Interceptor

var ErrStreamClosed = errors.New("grpc: stream closed")

ErrStreamClosed is returned when trying to call SendMsg or RecvMsg on a closed stream

func Interceptor Uses

func Interceptor(settings Settings) grpc.StreamClientInterceptor

Interceptor automatically restarts streams on non-expected errors To do so, the application should create a for-loop around RecvMsg, which returns the same errors that are received from the server.

An io.EOF indicates the end of the stream

To stop the reconnect behaviour, you have to cancel the context

type Settings Uses

type Settings struct {
    RetryableCodes []codes.Code
    Backoff        backoff.Config
}

Settings for Interceptor

Package restartstream imports 10 packages (graph) and is imported by 6 packages. Updated 2019-04-06. Refresh now. Tools for package owners.