From c0a02b13a4287d151ff484cf82da9b77ec5fc907 Mon Sep 17 00:00:00 2001 From: Dylan Moreland Date: Wed, 6 Nov 2024 15:08:14 -0500 Subject: [PATCH] Move around HWM. We were missing the last message --- cmd/devices-api/find_old_style_tasks.go | 28 ++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/cmd/devices-api/find_old_style_tasks.go b/cmd/devices-api/find_old_style_tasks.go index bcc50824..15388bd7 100644 --- a/cmd/devices-api/find_old_style_tasks.go +++ b/cmd/devices-api/find_old_style_tasks.go @@ -70,28 +70,28 @@ func (fost *findOldStyleTasks) Execute(_ context.Context, _ *flag.FlagSet, _ ... } for m := range pc.Messages() { - if m.Offset >= hwm-1 { - break - } - key := string(m.Key) if m.Value == nil { delete(missing, key) - continue - } + } else { - var out shared.CloudEvent[sdtask.CredentialData] + var out shared.CloudEvent[sdtask.CredentialData] - err := json.Unmarshal(m.Value, &out) - if err != nil { - panic(err) + err := json.Unmarshal(m.Value, &out) + if err != nil { + panic(err) + } + + if out.Data.SyntheticDevice == nil { + missing[key] = out + } else { + delete(missing, key) + } } - if out.Data.SyntheticDevice == nil { - missing[key] = out - } else { - delete(missing, key) + if m.Offset >= hwm-1 { + break } }