From 1da29fb6fdb2d1a843de2fd045f89758f0c7b8f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Fri, 2 Aug 2024 13:00:46 +0200 Subject: [PATCH] fix unmarshaling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- changelog/unreleased/fix-natsjskv-registry-2.md | 1 + ocis-pkg/natsjsregistry/watcher.go | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/changelog/unreleased/fix-natsjskv-registry-2.md b/changelog/unreleased/fix-natsjskv-registry-2.md index bfb72368ac..4649c8376b 100644 --- a/changelog/unreleased/fix-natsjskv-registry-2.md +++ b/changelog/unreleased/fix-natsjskv-registry-2.md @@ -2,4 +2,5 @@ Bugfix: Repair nats-js-kv registry The registry would always send traffic to only one pod. This is now fixed and load should be spread evenly. Also implements watcher method so the cache can use it. +https://github.com/owncloud/ocis/pull/9726 https://github.com/owncloud/ocis/pull/9656 diff --git a/ocis-pkg/natsjsregistry/watcher.go b/ocis-pkg/natsjsregistry/watcher.go index 0dc59f48db..867d726261 100644 --- a/ocis-pkg/natsjsregistry/watcher.go +++ b/ocis-pkg/natsjsregistry/watcher.go @@ -47,13 +47,14 @@ func (w *Watcher) Next() (*registry.Result, error) { return nil, errors.New("watcher stopped") } - var svc *registry.Service - if err := json.Unmarshal(kve.Value.Data, svc); err != nil { + var svc registry.Service + if err := json.Unmarshal(kve.Value.Data, &svc); err != nil { + _ = w.stop() return nil, err } return ®istry.Result{ - Service: svc, + Service: &svc, Action: kve.Action, }, nil }