Skip to content

Commit

Permalink
cache: only run memberlist for in-memory databroker (pomerium#1224)
Browse files Browse the repository at this point in the history
  • Loading branch information
travisgroth authored Aug 6, 2020
1 parent 4976fe3 commit 8e48ae0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type Cache struct {
localListener net.Listener
localGRPCServer *grpc.Server
localGRPCConnection *grpc.ClientConn
dataBrokerStorageType string //TODO remove in v0.11
deprecatedCacheClusterDomain string //TODO: remove in v0.11
}

Expand Down Expand Up @@ -89,6 +90,7 @@ func New(opts config.Options) (*Cache, error) {
localGRPCServer: localGRPCServer,
localGRPCConnection: localGRPCConnection,
deprecatedCacheClusterDomain: opts.GetDataBrokerURL().Hostname(),
dataBrokerStorageType: opts.DataBrokerStorageType,
}, nil
}

Expand All @@ -100,9 +102,11 @@ func (c *Cache) Register(grpcServer *grpc.Server) {
// Run runs the cache components.
func (c *Cache) Run(ctx context.Context) error {
t, ctx := tomb.WithContext(ctx)
t.Go(func() error {
return c.runMemberList(ctx)
})
if c.dataBrokerStorageType == config.StorageInMemoryName {
t.Go(func() error {
return c.runMemberList(ctx)
})
}
t.Go(func() error {
return c.localGRPCServer.Serve(c.localListener)
})
Expand Down

0 comments on commit 8e48ae0

Please sign in to comment.