Usiel commented on code in PR #32585:
URL: https://github.com/apache/superset/pull/32585#discussion_r1990498594


##########
superset/utils/slack.py:
##########
@@ -71,11 +71,12 @@ def get_channels(limit: int, extra_params: dict[str, Any]) 
-> list[SlackChannelS
     client = get_slack_client()
     channel_schema = SlackChannelSchema()
     channels: list[SlackChannelSchema] = []
+    extra_params = {"types": ",".join(SlackChannelTypes)}
     cursor = None
 
     while True:
         response = client.conversations_list(
-            limit=limit, cursor=cursor, exclude_archived=True, **extra_params
+            limit=999, cursor=cursor, exclude_archived=True, **extra_params

Review Comment:
   I inlined the `limit` because it never governed the amount of channels 
returned by the function. The function always returns all channels. The `limit` 
parameter here only governs the amount of channels returned by each Slack API 
response. 
   
   Going for the maximum (999) allowed by Slack is most efficient, imo. Lower 
values are more likely to result in rate-limiting (which is based on requests, 
not rows returned or similar).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to