diff --git a/backfill.go b/backfill.go index a62d48c..b9334f3 100644 --- a/backfill.go +++ b/backfill.go @@ -556,6 +556,10 @@ func (portal *Portal) convertAndSendBackfill(ctx context.Context, source *User, } } } + if len(events) == 0 { + log.Info().Msg("No events to send in backfill batch") + return + } if unreadHoursThreshold := portal.bridge.Config.Bridge.Backfill.UnreadHoursThreshold; unreadHoursThreshold > 0 && !markRead && len(messages) > 0 { markRead = messages[len(messages)-1].TimestampMs < time.Now().Add(-time.Duration(unreadHoursThreshold)*time.Hour).UnixMilli() if markRead { @@ -571,7 +575,7 @@ func (portal *Portal) convertAndSendBackfill(ctx context.Context, source *User, log.Info().Int("event_count", len(events)).Msg("Sending events to Matrix one by one") portal.sendBackfillLegacy(ctx, source, events, metas, markRead) } - zerolog.Ctx(ctx).Info().Msg("Finished sending backfill batch") + log.Info().Msg("Finished sending backfill batch") } func (portal *Portal) sendBackfillLegacy(ctx context.Context, source *User, events []*event.Event, metas []*BackfillPartMetadata, markRead bool) { diff --git a/msgconv/from-meta.go b/msgconv/from-meta.go index 1d03d8f..d3020d6 100644 --- a/msgconv/from-meta.go +++ b/msgconv/from-meta.go @@ -88,6 +88,9 @@ func (mc *MessageConverter) ToMatrix(ctx context.Context, msg *table.WrappedMess cm := &ConvertedMessage{ Parts: make([]*ConvertedMessagePart, 0), } + if msg.IsUnsent { + return cm + } for _, blobAtt := range msg.BlobAttachments { cm.Parts = append(cm.Parts, mc.blobAttachmentToMatrix(ctx, blobAtt)) }