event_store_client 1.1.5 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/event_store_client/adapters/grpc/commands/command.rb +2 -0
- data/lib/event_store_client/adapters/grpc/commands/streams/read.rb +13 -4
- data/lib/event_store_client/adapters/grpc/connection.rb +7 -0
- data/lib/event_store_client/configuration.rb +6 -0
- data/lib/event_store_client/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a39c7584996d6a235613a9b856b241faf1492afb4eb116b261d0cc861cf10084
|
4
|
+
data.tar.gz: 26552377ed9e80019f7c3fd54992074beada6b20be6e399cad78f9a900c7d021
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 937fc10a837a02049b407a2de39e98e805e7513e75aaf40fadb00c865e3dcd054e74e64abdd1574f77a8c0c9a6f6edfc7e8caead7c10444c8b010e16364e221c
|
7
|
+
data.tar.gz: 5e74d87c07895abe594c2c434079b35db3fddeb7968525c128480bcca1dd7f7d8112d4fb9869b425dd907e1888f3d23af7dfd2675fd1d71d454a9ca23355253d
|
@@ -44,10 +44,7 @@ module EventStoreClient
|
|
44
44
|
end
|
45
45
|
|
46
46
|
skip_decryption = options[:skip_decryption] || false
|
47
|
-
events =
|
48
|
-
raise StreamNotFound if res.stream_not_found
|
49
|
-
deserialize_event(res.event.event, skip_decryption: skip_decryption)
|
50
|
-
end
|
47
|
+
events = read_stream(opts, skip_decryption)
|
51
48
|
Success(events)
|
52
49
|
rescue StreamNotFound
|
53
50
|
Failure(:not_found)
|
@@ -55,6 +52,18 @@ module EventStoreClient
|
|
55
52
|
|
56
53
|
private
|
57
54
|
|
55
|
+
def read_stream(options, skip_decryption)
|
56
|
+
retries ||= 0
|
57
|
+
service.read(request.new(options: options), metadata: metadata).map do |res|
|
58
|
+
raise StreamNotFound if res.stream_not_found
|
59
|
+
deserialize_event(res.event.event, skip_decryption: skip_decryption)
|
60
|
+
end
|
61
|
+
rescue GRPC::Unavailable
|
62
|
+
sleep config.grpc_unavailable_retry_sleep
|
63
|
+
retry if (retries += 1) <= config.grpc_unavailable_retry_count
|
64
|
+
raise GRPCUnavailableRetryFailed
|
65
|
+
end
|
66
|
+
|
58
67
|
def deserialize_event(entry, skip_decryption: false)
|
59
68
|
data = (entry.data.nil? || entry.data.empty?) ? '{}' : entry.data
|
60
69
|
|
@@ -9,6 +9,8 @@ module EventStoreClient
|
|
9
9
|
class Connection
|
10
10
|
include Configuration
|
11
11
|
|
12
|
+
class SocketErrorRetryFailed < StandardError; end
|
13
|
+
|
12
14
|
# Initializes the proper stub with the necessary credentials
|
13
15
|
# to create working gRPC connection - Refer to generated grpc files
|
14
16
|
# @return [Stub] Instance of a given `Stub` klass
|
@@ -29,6 +31,7 @@ module EventStoreClient
|
|
29
31
|
attr_reader :cert
|
30
32
|
|
31
33
|
def initialize
|
34
|
+
retries ||= 0
|
32
35
|
@cert =
|
33
36
|
Net::HTTP.start(
|
34
37
|
config.eventstore_url.host, config.eventstore_url.port,
|
@@ -36,6 +39,10 @@ module EventStoreClient
|
|
36
39
|
verify_mode: verify_ssl,
|
37
40
|
&:peer_cert
|
38
41
|
)
|
42
|
+
rescue SocketError
|
43
|
+
sleep config.socket_error_retry_sleep
|
44
|
+
retry if (retries += 1) <= config.socket_error_retry_count
|
45
|
+
raise SocketErrorRetryFailed
|
39
46
|
end
|
40
47
|
|
41
48
|
def channel_credentials
|
@@ -32,6 +32,12 @@ module EventStoreClient
|
|
32
32
|
|
33
33
|
setting :logger
|
34
34
|
|
35
|
+
setting :socket_error_retry_sleep, 0.5
|
36
|
+
setting :socket_error_retry_count, 3
|
37
|
+
|
38
|
+
setting :grpc_unavailable_retry_sleep, 0.5
|
39
|
+
setting :grpc_unavailable_retry_count, 3
|
40
|
+
|
35
41
|
def self.configure
|
36
42
|
yield(config) if block_given?
|
37
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: event_store_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Wilgosz
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06
|
11
|
+
date: 2021-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-configurable
|
@@ -247,7 +247,7 @@ licenses:
|
|
247
247
|
- MIT
|
248
248
|
metadata:
|
249
249
|
allowed_push_host: https://rubygems.org
|
250
|
-
post_install_message:
|
250
|
+
post_install_message:
|
251
251
|
rdoc_options: []
|
252
252
|
require_paths:
|
253
253
|
- lib
|
@@ -262,8 +262,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
262
262
|
- !ruby/object:Gem::Version
|
263
263
|
version: '0'
|
264
264
|
requirements: []
|
265
|
-
rubygems_version: 3.1.
|
266
|
-
signing_key:
|
265
|
+
rubygems_version: 3.1.0.pre1
|
266
|
+
signing_key:
|
267
267
|
specification_version: 4
|
268
268
|
summary: Ruby integration for https://eventstore.org
|
269
269
|
test_files: []
|