Skip to content

Commit

Permalink
bridge_with_slack: Do not use a stale Zulip client for send_message.
Browse files Browse the repository at this point in the history
  • Loading branch information
rht authored and timabbott committed Jan 11, 2024
1 parent e6afe93 commit 0c92097
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions zulip/integrations/bridge_with_slack/run-slack-bridge
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit 0c92097

Please sign in to comment.