Skip to content

Commit

Permalink
Automatically restart bot when Slack closes a connection, handle acco…
Browse files Browse the repository at this point in the history
…unt_inactive and such. Closes #51.
  • Loading branch information
dblock committed Dec 24, 2015
1 parent 1630e44 commit 1cae4ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### Changelog

* [#51](https://github.com/dblock/slack-gamebot/issues/51): Automatically restart bot when Slack closes a connection - [@dblock](https://github.com/dblock).
* [#52](https://github.com/dblock/slack-gamebot/issues/52): Added an API `/status` endpoint that pings the first team - [@dblock](https://github.com/dblock).
* [#50](https://github.com/dblock/slack-gamebot/issues/50): Automatically disable teams with `account_inactive` - [@dblock](https://github.com/dblock).
* [#25](https://github.com/dblock/slack-gamebot/issues/25): Users can `draw` a challenge, all players have to `draw` - [@dblock](https://github.com/dblock).
Expand Down
7 changes: 5 additions & 2 deletions slack-gamebot/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ def initialize(attrs = {})
client.team = @team
end

def restart!(_wait = 1)
logger.info "#{team.name}: socket closed, ignoring restart."
def restart!(wait = 1)
# when an integration is disabled, a live socket is closed, which causes the default behavior of the client to restart
# it would keep retrying without checking for account_inactive or such, we want to restart via service which will disable an inactive team
logger.info "#{team.name}: socket closed, restarting ..."
SlackGamebot::Service.restart! team, self, wait
end
end
end

0 comments on commit 1cae4ce

Please sign in to comment.