mirror of
https://github.com/paymog/slack-cli.git
synced 2026-09-18 23:43:49 +08:00
Merge pull request #262 from flacoste/fix/search-rate-limit-retry
fix: add rate limiting and retry to SearchContext
This commit is contained in:
@@ -603,7 +603,12 @@ func (ch *ConversationsHandler) ConversationsSearchHandler(ctx context.Context,
|
||||
Count: params.limit,
|
||||
Page: params.page,
|
||||
}
|
||||
messagesRes, _, err := ch.apiProvider.Slack().SearchContext(ctx, params.query, searchParams)
|
||||
|
||||
rl := limiter.Tier2.Limiter()
|
||||
messagesRes, err := limiter.CallWithRetry(ctx, rl, 2, slackRetryAfter, func() (*slack.SearchMessages, error) {
|
||||
msgs, _, err := ch.apiProvider.Slack().SearchContext(ctx, params.query, searchParams)
|
||||
return msgs, err
|
||||
})
|
||||
if err != nil {
|
||||
ch.logger.Error("Slack SearchContext failed", zap.Error(err))
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user