sagikazarmark / crypt

Store and retrieve encrypted configs from etcd or consul
MIT License
10 stars 14 forks source link

Bug: Nats watch #267

Open cavus700 opened 3 months ago

cavus700 commented 3 months ago

There is a bug in the nats implementation. WatchWithContext() uses the watch-channel of nats.KeyValue to watch for events. This channel can return nil in some cases but is it not checked in the go routine. So it panics when watch.Updates() returns nil.

Furthermore I am not sure if it is correct/necessary but the nats connection is closed multiple times in WatchWithContext() and I don't see the purpose of waiting for 5 seconds after an update. Why not get updates asap? Sorry for the two off topic questions but I would appreciate some clarification.

cavus700 commented 3 months ago

I've created a PR for this https://github.com/sagikazarmark/crypt/pull/268

It does not work when the connections are closed