Skip to content

Commit

Permalink
backfill: fix handling empty responses
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Nov 25, 2024
1 parent 28b614d commit 235d5e5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/connector/backfill.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ func (tc *TwitterClient) FetchMessages(ctx context.Context, params bridgev2.Fetc
if err != nil {
return nil, err
}
if len(messages) == 0 {
log.Debug().
Str("timeline_status", string(messageResp.ConversationTimeline.Status)).
Msg("No messages in backfill response")
return &bridgev2.FetchMessagesResponse{
Messages: make([]*bridgev2.BackfillMessage, 0),
HasMore: false,
Forward: params.Forward,
}, nil
}

converted := make([]*bridgev2.BackfillMessage, 0, len(messages))
log.Debug().
Expand Down

0 comments on commit 235d5e5

Please sign in to comment.