slack-ruby-bot-server 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c2baab12040f4100e3fb8ece5469b8b4ed6616f2
4
- data.tar.gz: 45d3c6c0c456033a0a1c799ab71c298b3b7d72b6
3
+ metadata.gz: '08d2ca6a35e52167fede4422f6f7cb4e436aaf78'
4
+ data.tar.gz: 580793c0cddae73b27ddc7f65d26208d2b16bb1e
5
5
  SHA512:
6
- metadata.gz: fced549dc1ec1f687223b076c6c73d50e5d14fd1976dcf007f392beb8b9e7f0b2c0519d011acbd1d20db7a86e3cee58b3974f0f444c1013d5edb10e8501f593e
7
- data.tar.gz: 383451e38ac282f35ee977179a2e20a1df09ba40664cb2c38dd1a28d5fa1cc28bbf31de19c0bdfe2682df4d7f003d788983927f5973d0fbcc8356add93475f2a
6
+ metadata.gz: f17072e2f9db331a104cf2b6ab1a111f90177240bd5c73eeb69d65673797cbc305913c7845e0d4d0693eededa00f85d51cd064fcf2ef76eb539ae50f90bf2dc8
7
+ data.tar.gz: 3136311a0f290eb8f714a8e7dab0fc5e65e02eaba7281dc05de1486c1b3d948f056f2cfe48c1de8f7395e3a4c5626ca0f61e5742c2f9ceb535024f0a7ee8913d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ### Changelog
2
2
 
3
+ #### 0.8.1 (2018/9/20)
4
+
5
+ * [#79](https://github.com/slack-ruby/slack-ruby-bot-server/pull/79): Fix: ping worker terminates on a failed restart - [@dblock](https://github.com/dblock).
6
+
3
7
  #### 0.8.0 (2018/9/8)
4
8
 
5
9
  * [#75](https://github.com/slack-ruby/slack-ruby-bot-server/pull/75): Default to `async-websocket` instead of `celluloid-io` - [@dblock](https://github.com/dblock).
data/README.md CHANGED
@@ -13,7 +13,7 @@ A library that contains a [Grape](http://github.com/ruby-grape/grape) API servin
13
13
 
14
14
  ### Stable Release
15
15
 
16
- You're reading the documentation for the **stable** release of slack-ruby-bot-server, v0.8.0. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
16
+ You're reading the documentation for the **stable** release of slack-ruby-bot-server, 0.8.1. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
17
17
 
18
18
  ### Try Me
19
19
 
@@ -68,20 +68,43 @@ module SlackRubyBotServer
68
68
  @error_count += 1
69
69
  return true if retries_left?
70
70
  restart!
71
- false
72
71
  end
73
72
 
74
73
  def restart!
75
74
  logger.warn "RESTART: #{owner}"
76
- begin
77
- connection.close
78
- rescue Async::Wrapper::Cancelled
79
- # ignore, from connection.close
80
- end
75
+ close_connection
76
+ close_driver
77
+ emit_close
78
+ false
79
+ rescue StandardError => e
80
+ logger.warn "Error restarting team #{owner.id}: #{e.message}."
81
+ true
82
+ end
83
+
84
+ def close_connection
85
+ return unless connection
86
+ connection.close
87
+ rescue Async::Wrapper::Cancelled
88
+ # ignore, from connection.close
89
+ rescue StandardError => e
90
+ logger.warn "Error closing connection for #{owner.id}: #{e.message}."
91
+ raise e
92
+ end
93
+
94
+ def close_driver
95
+ return unless driver
81
96
  driver.close
97
+ rescue StandardError => e
98
+ logger.warn "Error closing driver for #{owner.id}: #{e.message}."
99
+ raise e
100
+ end
101
+
102
+ def emit_close
103
+ return unless driver
82
104
  driver.emit(:close, WebSocket::Driver::CloseEvent.new(1001, 'bot offline'))
83
105
  rescue StandardError => e
84
- logger.warn "Error restarting team #{owner.id}: #{e.message}."
106
+ logger.warn "Error sending :close event to driver for #{owner.id}: #{e.message}."
107
+ raise e
85
108
  end
86
109
 
87
110
  def ping_interval
@@ -89,11 +112,11 @@ module SlackRubyBotServer
89
112
  end
90
113
 
91
114
  def retries_left?
92
- retries_left >= 0
115
+ retry_count - error_count >= 0
93
116
  end
94
117
 
95
118
  def retries_left
96
- retry_count - error_count
119
+ [0, retry_count - error_count].max
97
120
  end
98
121
 
99
122
  def retry_count
@@ -1,3 +1,3 @@
1
1
  module SlackRubyBotServer
2
- VERSION = '0.8.0'.freeze
2
+ VERSION = '0.8.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-ruby-bot-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-08 00:00:00.000000000 Z
11
+ date: 2018-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-websocket
@@ -295,7 +295,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
295
295
  version: '0'
296
296
  requirements: []
297
297
  rubyforge_project:
298
- rubygems_version: 2.6.14
298
+ rubygems_version: 2.6.13
299
299
  signing_key:
300
300
  specification_version: 4
301
301
  summary: A Grape API serving a Slack bot to multiple teams.