diff --git a/pkg/connector/backfill.go b/pkg/connector/backfill.go index cb38d98..ab669ea 100644 --- a/pkg/connector/backfill.go +++ b/pkg/connector/backfill.go @@ -84,10 +84,12 @@ func (s *SlackClient) FetchMessages(ctx context.Context, params bridgev2.FetchMe if !ok { return nil, fmt.Errorf("invalid thread root ID") } + s.threadFetchLock.Lock() chunk, err = s.Client.GetConversationRepliesContext(ctx, &slack.GetConversationRepliesParameters{ GetConversationHistoryParameters: *slackParams, Timestamp: threadTS, }) + s.threadFetchLock.Unlock() } else { chunk, err = s.Client.GetConversationHistoryContext(ctx, slackParams) if chunk != nil { diff --git a/pkg/connector/client.go b/pkg/connector/client.go index a496fa6..0802f1a 100644 --- a/pkg/connector/client.go +++ b/pkg/connector/client.go @@ -164,6 +164,7 @@ type SlackClient struct { userGroupInfoCacheLock sync.Mutex lastReadCache map[string]string lastReadCacheLock sync.Mutex + threadFetchLock sync.Mutex } var (