File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 2
2
Maintain websocket connections to Slack.
3
3
*)
4
4
5
+ open Printf
5
6
open Lwt
6
7
open Log
7
8
@@ -232,6 +233,12 @@ type connection_result =
232
233
| Giveup
233
234
| Connected of connection
234
235
236
+ let string_of_connection_result = function
237
+ | Retry -> " Retry"
238
+ | Giveup -> " Giveup"
239
+ | Connected x ->
240
+ sprintf " Connected %s" (Slack_api_teamid. to_string x.conn_id)
241
+
235
242
let create_connection uid slack_teamid input_handler handle_permanent_failure =
236
243
logf `Debug " Create websocket connection for Slack team %s"
237
244
(Slack_api_teamid. to_string slack_teamid);
@@ -243,9 +250,10 @@ let create_connection uid slack_teamid input_handler handle_permanent_failure =
243
250
| Some access_token ->
244
251
Slack_api. rtm_start access_token >> = fun resp ->
245
252
match Slack_util. extract_result resp with
246
- | None ->
247
- return Retry
248
- | Some x ->
253
+ | `Account_inactive ->
254
+ Slack_user. clear_posting_param uid >> = fun () ->
255
+ return Giveup
256
+ | `OK x ->
249
257
let ws_url = x.Slack_api_t. url in
250
258
let waiting_for_pong = ref None in
251
259
create_websocket_connection ws_url
You can’t perform that action at this time.
0 commit comments