Skip to content

Commit

Permalink
Re-enable direct gets
Browse files Browse the repository at this point in the history
Signed-off-by: Byron Ruth <[email protected]>
  • Loading branch information
bruth committed Mar 22, 2024
1 parent 92a9c73 commit f47fe17
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions pkg/drivers/nats/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,6 @@ func newBackend(ctx context.Context, connection string, tlsInfo tls.Config, lega
cancel()
return nil, fmt.Errorf("failed to get or create bucket: %w", err)
}
if err := disableDirectGets(ctx, js, config); err != nil {
cancel()
return nil, fmt.Errorf("failed to disable direct gets: %w", err)
}

logrus.Infof("bucket initialized: %s", config.bucket)

Expand Down Expand Up @@ -231,28 +227,3 @@ func getOrCreateBucket(ctx context.Context, js jetstream.JetStream, config *Conf
}
}
}

func disableDirectGets(ctx context.Context, js jetstream.JetStream, config *Config) error {
for {
str, err := js.Stream(ctx, fmt.Sprintf("KV_%s", config.bucket))
if errors.Is(err, context.DeadlineExceeded) {
continue
}
if err != nil {
return fmt.Errorf("failed to get stream info: %w", err)
}

scfg := str.CachedInfo().Config
scfg.AllowDirect = false

_, err = js.UpdateStream(ctx, scfg)
if errors.Is(err, context.DeadlineExceeded) {
continue
}
if err != nil {
return fmt.Errorf("failed to update stream config: %w", err)
}

return nil
}
}

0 comments on commit f47fe17

Please sign in to comment.