@@ -165,6 +165,7 @@ def _handle_send_err(self, err: SlackApiError, channel_name: str):
165165 channel_id = self .resolve_channel (channel_name , only_public = True ).id
166166 self ._join_channel (channel_id = channel_id )
167167 logger .info (f"Joined channel { channel_name } " )
168+ return
168169 elif err_type == "channel_not_found" :
169170 raise MessagingIntegrationError (
170171 f"Channel { channel_name } was not found by the Elementary app. Please add the app to the channel."
@@ -244,6 +245,7 @@ def resolve_channel(
244245 def get_channels (
245246 self ,
246247 cursor : str | None = None ,
248+ only_public : bool = False ,
247249 timeout_seconds : int = 15 ,
248250 ) -> ChannelsResponse :
249251 channels_response = ChannelsResponse (channels = [], retry_after = None , cursor = None )
@@ -252,7 +254,9 @@ def get_channels(
252254 time_elapsed : float = 0
253255 while time_elapsed < timeout_seconds :
254256 try :
255- channels , cursor = self ._list_conversations (cursor )
257+ channels , cursor = self ._list_conversations (
258+ cursor , only_public = only_public
259+ )
256260 time_elapsed = time .time () - start_time
257261 logger .debug (
258262 f"Got a batch of { len (channels )} channels! time elapsed: { time_elapsed } seconds"
@@ -274,7 +278,8 @@ def get_channels(
274278 if isinstance (retry_after , str ) and retry_after .isdigit ():
275279 channels_response .retry_after = int (retry_after )
276280 else :
277- channels_response .retry_after = 60
281+ # should never happen - as the header should always be valid. just a safety net.
282+ channels_response .retry_after = 5
278283 break
279284 raise
280285
0 commit comments