From f2927db86577ea7c491bf4d134f630a3a9f309be Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 26 Aug 2023 16:45:11 +0300 Subject: [PATCH] Cancel batch sending if there's nothing to send --- backfill.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/backfill.go b/backfill.go index 6d4e124..93fbb11 100644 --- a/backfill.go +++ b/backfill.go @@ -243,6 +243,14 @@ func (portal *Portal) backfillSendBatch(ctx context.Context, converted []*Conver dbMessages = append(dbMessages, dbm) } } + if len(dbMessages) == 0 { + log.Warn(). + Int("converted_count", len(converted)). + Int("event_count", len(events)). + Int("db_count", len(dbMessages)). + Msg("Didn't get any parts to send from converted messages") + return + } forward := true log.Debug(). Int("event_count", len(events)).