Closed MashinaMashina closed 7 months ago
We do need a KV Update function - but maybe make it a specific function rather than overuse this code path. This code path mainly is there to upgrade configuration of old buckets to current internal needs afaik
Hello @MashinaMashina, thanks for creating the issue. As @ripienaar said, we'll be adding an UpdateKeyValue()
method for that, rather than modifying create. Possibly we'll also add CreateOrUpdate
to match what we have for streams and consumers.
We've added UpdateKeyValue
and CreateOrUpdateKeyValue
methods in a recent PR: https://github.com/nats-io/nats.go/pull/1549
It is now available in release v1.33.1. Thank you for creating the issue!
Observed behavior
When I use nats.jetstream.CreateKeyValue after changing TTL, I got error "nats: stream name already in use"
Expected behavior
I use nats.jetstream.CreateKeyValue and the TTL will update.
Server and client version
nats-io/nats.go version 1.31.0 nats in docker: nats:2.9-alpine3.18
Host environment
No response
Steps to reproduce
... connect to nats
==================
this behavior because we have this code (https://github.com/nats-io/nats.go/blob/main/kv.go#L489):
In my opinion it must be like this:
If configs are equals - do nothing, else - update stream. Now updating only if there are no changes - this is wrong.