From 0c92097bd76c3c7663d908770323da40736cd475 Mon Sep 17 00:00:00 2001 From: rht Date: Fri, 5 Jan 2024 16:22:08 -0500 Subject: [PATCH] bridge_with_slack: Do not use a stale Zulip client for send_message. --- .../bridge_with_slack/run-slack-bridge | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/zulip/integrations/bridge_with_slack/run-slack-bridge b/zulip/integrations/bridge_with_slack/run-slack-bridge index c3f48f9aa..32c6deb1b 100755 --- a/zulip/integrations/bridge_with_slack/run-slack-bridge +++ b/zulip/integrations/bridge_with_slack/run-slack-bridge @@ -53,11 +53,17 @@ class SlackBridge: } # zulip-specific - self.zulip_client = zulip.Client( - email=self.zulip_config["email"], - api_key=self.zulip_config["api_key"], - site=self.zulip_config["site"], - ) + def zulip_client_constructor() -> zulip.Client: + return zulip.Client( + email=self.zulip_config["email"], + api_key=self.zulip_config["api_key"], + site=self.zulip_config["site"], + ) + + self.zulip_client = zulip_client_constructor() + # Temporary workaround until + # https://github.com/zulip/python-zulip-api/issues/761 is fixed. + self.zulip_client_constructor = zulip_client_constructor # slack-specific self.slack_client = rtm @@ -121,7 +127,7 @@ class SlackBridge: subject=zulip_endpoint["topic"], content=content, ) - self.zulip_client.send_message(msg_data) + self.zulip_client_constructor().send_message(msg_data) self.slack_client.start()