From f47fe172a9f74b06b7d255324bec4fdc73943a10 Mon Sep 17 00:00:00 2001 From: Byron Ruth Date: Fri, 22 Mar 2024 08:15:11 -0400 Subject: [PATCH] Re-enable direct gets Signed-off-by: Byron Ruth --- pkg/drivers/nats/new.go | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/pkg/drivers/nats/new.go b/pkg/drivers/nats/new.go index 977d9956..5a8838db 100644 --- a/pkg/drivers/nats/new.go +++ b/pkg/drivers/nats/new.go @@ -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) @@ -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 - } -}