Skip to content

Commit 62d58a2

Browse files
authored
Merge pull request #93 from dblock/remove-ping
Removed ping worker.
2 parents 6556fe2 + fed0db8 commit 62d58a2

File tree

13 files changed

+13
-359
lines changed

13 files changed

+13
-359
lines changed

.rubocop_todo.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2018-09-08 18:09:56 -0400 using RuboCop version 0.58.2.
3+
# on 2019-02-25 14:24:34 -0500 using RuboCop version 0.58.2.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
@@ -16,11 +16,6 @@ Layout/IndentHeredoc:
1616
- 'sample_apps/sample_app_activerecord/commands/help.rb'
1717
- 'sample_apps/sample_app_mongoid/commands/help.rb'
1818

19-
# Offense count: 1
20-
Lint/HandleExceptions:
21-
Exclude:
22-
- 'lib/slack-ruby-bot-server/ping.rb'
23-
2419
# Offense count: 3
2520
# Configuration parameters: Blacklist.
2621
# Blacklist: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
### Changelog
22

3-
#### 0.8.4 (Next)
3+
#### 0.9.0 (Next)
44

5+
* [#93](https://github.com/slack-ruby/slack-ruby-bot-server/pull/93): Removed ping worker in favor of slack-ruby-client lower level ping - [@dblock](https://github.com/dblock).
56
* Your contribution here.
67

78
#### 0.8.3 (2019/01/17)

README.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -152,22 +152,6 @@ SlackRubyBotServer.configure do |config|
152152
end
153153
```
154154

155-
#### Ping Worker
156-
157-
Each `SlackRubyBotServer::Server` instance will start a ping worker that will periodically check the online status of the bot via the Slack web [auth.test](https://api.slack.com/methods/auth.test) and [users.getPresence](https://api.slack.com/methods/users.getPresence) APIs, and will forcefully close the connection if the bot goes offline, causing an automatic reconnect.
158-
159-
You can configure the ping interval, number of retries before restart, and disable the ping worker entirely.
160-
161-
```ruby
162-
SlackRubyBotServer.configure do |config|
163-
config.ping = {
164-
enabled: true, # set to false to disable the ping worker
165-
ping_interval: 30, # interval in seconds
166-
retry_count: 3 # number of unsuccessful retries until a restart
167-
}
168-
end
169-
```
170-
171155
### Access Tokens
172156

173157
By default the implementation of [Team](lib/slack-ruby-bot-server/models/team) stores a `bot_access_token` that grants a certain amount of privileges to the bot user as described in [Slack OAuth Docs](https://api.slack.com/docs/oauth). You may not want a bot user at all, or may require different auth scopes, such as `users.profile:read` to access user profile information via `Slack::Web::Client#users_profile_get`. To obtain the non-bot access token make the following changes.

UPGRADING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Upgrading Slack-Ruby-Bot-Server
22
===============================
33

4+
### Upgrading to >= 0.9.0
5+
6+
### Removed Ping Worker
7+
8+
The ping worker that was added in 0.7.0 has been removed in favor of a lower level implementation in slack-ruby-client. Remove any references to `ping` options.
9+
10+
See [slack-ruby-client#226](https://github.com/slack-ruby/slack-ruby-client/pull/226) for more information.
11+
412
### Upgrading to >= 0.8.0
513

614
### Different Asynchronous I/O Library

lib/slack-ruby-bot-server.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
require 'grape-swagger'
44
require 'slack-ruby-bot'
55
require 'slack-ruby-bot-server/server'
6-
require 'slack-ruby-bot-server/ping'
76
require 'slack-ruby-bot-server/config'
87

98
require 'slack-ruby-bot-server/ext'

lib/slack-ruby-bot-server/config.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@ module Config
33
extend self
44

55
attr_accessor :server_class
6-
attr_accessor :ping
76
attr_accessor :database_adapter
87

98
def reset!
10-
self.ping = nil
119
self.server_class = SlackRubyBotServer::Server
1210
self.database_adapter = if defined?(::Mongoid)
1311
:mongoid

lib/slack-ruby-bot-server/ping.rb

Lines changed: 0 additions & 149 deletions
This file was deleted.

lib/slack-ruby-bot-server/server.rb

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ class Server < SlackRubyBot::Server
77
def initialize(attrs = {})
88
attrs = attrs.dup
99
@team = attrs.delete(:team)
10-
@ping_options = attrs.delete(:ping) || {}
1110
raise 'Missing team' unless @team
1211
attrs[:token] = @team.token
1312
super(attrs)
@@ -24,19 +23,8 @@ def restart!(wait = 1)
2423

2524
private
2625

27-
attr_reader :ping_options
28-
29-
def create_ping
30-
return unless !ping_options.key?(:enabled) || ping_options[:enabled]
31-
SlackRubyBotServer::Ping.new(client, ping_options)
32-
end
33-
3426
def open!
3527
client.owner = team
36-
client.on :open do |_event|
37-
worker = create_ping
38-
worker.start! if worker
39-
end
4028
end
4129
end
4230
end

lib/slack-ruby-bot-server/service.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ def start!(team)
3131
run_callbacks :starting, team
3232
logger.info "Starting team #{team}."
3333
options = { team: team }
34-
options[:ping] = SlackRubyBotServer::Config.ping if SlackRubyBotServer::Config.ping
3534
server = SlackRubyBotServer::Config.server_class.new(options)
3635
start_server! team, server
3736
run_callbacks :started, team
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module SlackRubyBotServer
2-
VERSION = '0.8.4'.freeze
2+
VERSION = '0.9.0'.freeze
33
end

0 commit comments

Comments
 (0)