anycable 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/anycable/broadcast_adapters/redis.rb +1 -1
- data/lib/anycable/rpc_handler.rb +27 -4
- data/lib/anycable/version.rb +1 -1
- metadata +4 -5
- data/lib/anycable/handler/capture_exceptions.rb +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 982192dbe84e0576b13033aadf3ead0238e28bf4c30b6dec2d08228cd2093f3c
|
4
|
+
data.tar.gz: 9af924544238340e0c5b171a738b9bec99ebe25c13cc398d279318f6c9cbef12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba03a684ddce90df929c469deb4b219a494578ab9c203321e9c9f900810f98132eb74d8fc16aa1b79c6042c28bd5b3da2ac83d39bd4e25944127191dc4b2f8b7
|
7
|
+
data.tar.gz: 77a874ad448dff0cca9d8ada4259c8c48ab4fdb87d1df1f3c6bee1dab50f23335f1fc390ee60fb96483a89cc0071700945bdffa73f908745987de2c2e7877c91
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 0.6.3 (2019-03-26)
|
6
|
+
|
7
|
+
- Relax `redis` gem version requirement. ([@palkan][])
|
8
|
+
|
9
|
+
Use the same restriction as Action Cable does (`>= 3`).
|
10
|
+
|
5
11
|
## 0.6.2 (2019-03-15)
|
6
12
|
|
7
13
|
- Add GRPC service method name and message content to exception notifications ([@sponomarev][])
|
data/lib/anycable/rpc_handler.rb
CHANGED
@@ -4,15 +4,12 @@ require "anycable/socket"
|
|
4
4
|
require "anycable/rpc/rpc_pb"
|
5
5
|
require "anycable/rpc/rpc_services_pb"
|
6
6
|
|
7
|
-
require "anycable/handler/capture_exceptions"
|
8
|
-
|
9
7
|
# rubocop:disable Metrics/AbcSize
|
10
8
|
# rubocop:disable Metrics/MethodLength
|
9
|
+
# rubocop:disable Metrics/ClassLength
|
11
10
|
module AnyCable
|
12
11
|
# RPC service handler
|
13
12
|
class RPCHandler < AnyCable::RPC::Service
|
14
|
-
prepend AnyCable::Handler::CaptureExceptions
|
15
|
-
|
16
13
|
# Handle connection request from WebSocket server
|
17
14
|
def connect(request, _unused_call)
|
18
15
|
logger.debug("RPC Connect: #{request.inspect}")
|
@@ -32,6 +29,13 @@ module AnyCable
|
|
32
29
|
transmissions: socket.transmissions
|
33
30
|
)
|
34
31
|
end
|
32
|
+
rescue StandardError => exp
|
33
|
+
notify_exception(exp, :connect, request)
|
34
|
+
|
35
|
+
AnyCable::ConnectionResponse.new(
|
36
|
+
status: AnyCable::Status::ERROR,
|
37
|
+
error_msg: exp.message
|
38
|
+
)
|
35
39
|
end
|
36
40
|
|
37
41
|
def disconnect(request, _unused_call)
|
@@ -50,6 +54,13 @@ module AnyCable
|
|
50
54
|
else
|
51
55
|
AnyCable::DisconnectResponse.new(status: AnyCable::Status::FAILURE)
|
52
56
|
end
|
57
|
+
rescue StandardError => exp
|
58
|
+
notify_exception(exp, :disconnect, request)
|
59
|
+
|
60
|
+
AnyCable::DisconnectResponse.new(
|
61
|
+
status: AnyCable::Status::ERROR,
|
62
|
+
error_msg: exp.message
|
63
|
+
)
|
53
64
|
end
|
54
65
|
|
55
66
|
def command(message, _unused_call)
|
@@ -75,6 +86,13 @@ module AnyCable
|
|
75
86
|
streams: socket.streams,
|
76
87
|
transmissions: socket.transmissions
|
77
88
|
)
|
89
|
+
rescue StandardError => exp
|
90
|
+
notify_exception(exp, :command, message)
|
91
|
+
|
92
|
+
AnyCable::CommandResponse.new(
|
93
|
+
status: AnyCable::Status::ERROR,
|
94
|
+
error_msg: exp.message
|
95
|
+
)
|
78
96
|
end
|
79
97
|
|
80
98
|
private
|
@@ -114,7 +132,12 @@ module AnyCable
|
|
114
132
|
def factory
|
115
133
|
AnyCable.connection_factory
|
116
134
|
end
|
135
|
+
|
136
|
+
def notify_exception(exp, method_name, message)
|
137
|
+
AnyCable::ExceptionsHandling.notify(exp, method_name.to_s, message.to_h)
|
138
|
+
end
|
117
139
|
end
|
118
140
|
end
|
119
141
|
# rubocop:enable Metrics/AbcSize
|
120
142
|
# rubocop:enable Metrics/MethodLength
|
143
|
+
# rubocop:enable Metrics/ClassLength
|
data/lib/anycable/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anycable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- palkan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: anyway_config
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.
|
117
|
+
version: 0.65.0
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.
|
124
|
+
version: 0.65.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: simplecov
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -172,7 +172,6 @@ files:
|
|
172
172
|
- lib/anycable/cli.rb
|
173
173
|
- lib/anycable/config.rb
|
174
174
|
- lib/anycable/exceptions_handling.rb
|
175
|
-
- lib/anycable/handler/capture_exceptions.rb
|
176
175
|
- lib/anycable/health_server.rb
|
177
176
|
- lib/anycable/middleware.rb
|
178
177
|
- lib/anycable/middleware_chain.rb
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "anycable/rpc/rpc_pb"
|
4
|
-
|
5
|
-
module AnyCable
|
6
|
-
module Handler # :nodoc:
|
7
|
-
# Handle app-level errors.
|
8
|
-
#
|
9
|
-
# NOTE: this functionality couldn't be implemeted
|
10
|
-
# as middleware, 'cause interceptors do not support
|
11
|
-
# aborting the call and returning a data
|
12
|
-
module CaptureExceptions
|
13
|
-
RESPONSE_CLASS = {
|
14
|
-
command: AnyCable::CommandResponse,
|
15
|
-
connect: AnyCable::ConnectionResponse,
|
16
|
-
disconnect: AnyCable::DisconnectResponse
|
17
|
-
}.freeze
|
18
|
-
|
19
|
-
RESPONSE_CLASS.keys.each do |mid|
|
20
|
-
module_eval <<~CODE, __FILE__, __LINE__ + 1
|
21
|
-
def #{mid}(message, *)
|
22
|
-
capture_exceptions(:#{mid}, message) { super }
|
23
|
-
end
|
24
|
-
CODE
|
25
|
-
end
|
26
|
-
|
27
|
-
def capture_exceptions(method_name, message)
|
28
|
-
yield
|
29
|
-
rescue StandardError => exp
|
30
|
-
AnyCable::ExceptionsHandling.notify(exp, method_name.to_s, message.to_h)
|
31
|
-
|
32
|
-
RESPONSE_CLASS.fetch(method_name).new(
|
33
|
-
status: AnyCable::Status::ERROR,
|
34
|
-
error_msg: exp.message
|
35
|
-
)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|