Skip to content

Commit

Permalink
Merge pull request #360 from streamdal/blinktag/relay_update_defaults
Browse files Browse the repository at this point in the history
Apply default gRPC settings to a relay if none specified
  • Loading branch information
blinktag committed Jul 12, 2023
2 parents a51e9cd + 01e24d3 commit f15555b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions actions/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ func (a *Actions) UpdateRelay(ctx context.Context, relayID string, relayOpts *op
}

if relay.Active {
a.log.Debugf("relay '%s' is active, stopping relay", relayID)

// Close existing relay
relay.CancelFunc()
relay.Active = false
Expand Down
7 changes: 6 additions & 1 deletion relay/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
rpubsubTypes "github.com/batchcorp/plumber/backends/rpubsub/types"
rstreamsTypes "github.com/batchcorp/plumber/backends/rstreams/types"
"github.com/batchcorp/plumber/prometheus"
"github.com/batchcorp/plumber/validate"
)

const (
Expand Down Expand Up @@ -122,7 +123,11 @@ func validateConfig(cfg *Config) error {
}

if cfg.GRPCAddress == "" {
return ErrMissingGRPCAddress
cfg.GRPCAddress = validate.GRPCCollectorAddress
}

if cfg.Timeout == 0 {
cfg.Timeout = validate.GRPCDefaultTimeoutSeconds * time.Second
}

if cfg.RelayCh == nil {
Expand Down

0 comments on commit f15555b

Please sign in to comment.