korbit-ai[bot] commented on code in PR #32585:
URL: https://github.com/apache/superset/pull/32585#discussion_r1988451377
##########
superset/utils/slack.py:
##########
@@ -99,18 +99,25 @@ def get_channels_with_search(
all channels and filter them ourselves
This will search by slack name or id
"""
- extra_params = {}
- extra_params["types"] = ",".join(types) if types else None
try:
channels = get_channels(
- limit=limit,
- extra_params=extra_params,
force=force,
cache_timeout=86400,
)
Review Comment:
### Function Call Parameter Mismatch <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The get_channels() function call in get_channels_with_search() includes
parameters 'force' and 'cache_timeout' that are not defined in the function
signature.
###### Why this matters
This will raise a TypeError at runtime since the function doesn't accept
these parameters, breaking the channel retrieval functionality.
###### Suggested change ∙ *Feature Preview*
Remove the unsupported parameters from the get_channels() call:
```python
channels = get_channels()
```
</details>
<sub>
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/625dcf51-4662-4260-a228-ceb29ed99779?suggestedFixEnabled=true)
💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:0dfae944-4903-479a-8a4c-94f15350aa51 -->
##########
superset/tasks/slack.py:
##########
@@ -0,0 +1,27 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+import logging
+
+from superset.extensions import celery_app
+from superset.utils.slack import get_channels
+
+logger = logging.getLogger(__name__)
+
+
+@celery_app.task(name="slack.cache_channels")
+def cache_channels() -> None:
+ get_channels(force=True)
Review Comment:
### Missing Celery Task Retry Mechanism <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The Celery task lacks retry mechanisms and error handling for network
failures when caching Slack channels.
###### Why this matters
Network operations can fail transiently. Without retries, a temporary
network issue could cause the cache to remain empty, leading to additional API
calls and performance degradation.
###### Suggested change ∙ *Feature Preview*
Add retry mechanism and error handling to the Celery task:
```python
@celery_app.task(name="slack.cache_channels", bind=True, max_retries=3)
def cache_channels(self) -> None:
try:
get_channels(force=True)
except Exception as ex:
self.retry(countdown=exponential_backoff(self.request.retries),
exc=ex)
```
</details>
<sub>
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/f51de996-d591-4dc9-9118-5fec8d9ed52c?suggestedFixEnabled=true)
💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:d730bf75-7580-4e4d-ade9-b40932d8178c -->
--
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]