dblock / slack-strava

(Re)Post Strava activities to Slack
https://slava.playplay.io
MIT License
37 stars 6 forks source link

Race condition when bragging on a team with lots of channels #133

Closed dblock closed 2 years ago

dblock commented 2 years ago

If a team has a lot of channels, then https://github.com/dblock/slack-strava/blob/a775da9c9cc9f5cb37e7d8645f506cf1bd1ebbd3/slack-strava/models/team.rb#L95 will take a very long time and cause another activity update loop to kick in, causing duplicates to be posted.

Need a way to either get only channels that the bot is a member of in a single query, cache, and/or avoid the race condition altogether.

team.slack_client.users_conversations(user: team.bot_user_id).channels
dblock commented 2 years ago

Closed via #135