whi-cassie 1.3.2 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/HISTORY.md +9 -0
- data/VERSION +1 -1
- data/lib/cassie.rb +11 -3
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: da71885a1923c8c8d801ae3312151406ec78630237c43f9057c4abc6970626cd
|
|
4
|
+
data.tar.gz: a4ac1795d699b89efac12f4c5455d84095dacfe07d5634754a3ac8e129d8553f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 55c5506a91a5a6cc353d64ca12a0a57bb6cd691a1f4314e257fc468cfb0bdd12b60a590a1663a2cd3b200ca9da8891c80de6cd43c4b0fc12910ca155a96cead3
|
|
7
|
+
data.tar.gz: 07463a9d5b35522559405d8c94f35cd4c922e2c59e7bf62fc2cc99a91d3ff22503f9900ece00fa4ffec0d050fa5c2712b8da90b150b99d6b6eb6a0c6f02bcc00
|
data/HISTORY.md
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.3.
|
|
1
|
+
1.3.4
|
data/lib/cassie.rb
CHANGED
|
@@ -112,11 +112,13 @@ class Cassie
|
|
|
112
112
|
# Close the connections to the Cassandra cluster.
|
|
113
113
|
def disconnect
|
|
114
114
|
logger&.info("Cassie.disconnect from #{config.sanitized_cluster}")
|
|
115
|
+
old_session = nil
|
|
115
116
|
@monitor.synchronize do
|
|
116
|
-
@session
|
|
117
|
+
old_session = @session
|
|
117
118
|
@session = nil
|
|
118
119
|
@prepared_statements = {}
|
|
119
120
|
end
|
|
121
|
+
old_session&.close
|
|
120
122
|
end
|
|
121
123
|
|
|
122
124
|
# Return true if the connection to the Cassandra cluster has been established.
|
|
@@ -127,9 +129,12 @@ class Cassie
|
|
|
127
129
|
# Force reconnection. If you're using this code in conjunction in a forking server environment
|
|
128
130
|
# like passenger or unicorn you should call this method after forking.
|
|
129
131
|
def reconnect
|
|
130
|
-
|
|
132
|
+
existing_session = @session
|
|
131
133
|
@monitor.synchronize do
|
|
132
|
-
|
|
134
|
+
if @session == existing_session
|
|
135
|
+
disconnect
|
|
136
|
+
connect
|
|
137
|
+
end
|
|
133
138
|
end
|
|
134
139
|
end
|
|
135
140
|
|
|
@@ -311,6 +316,9 @@ class Cassie
|
|
|
311
316
|
end
|
|
312
317
|
|
|
313
318
|
session.execute(statement, options || {})
|
|
319
|
+
rescue Cassandra::Errors::NoHostsAvailable => e
|
|
320
|
+
reconnect
|
|
321
|
+
raise e
|
|
314
322
|
ensure
|
|
315
323
|
if statement.is_a?(Cassandra::Statement) && !subscribers.empty?
|
|
316
324
|
payload = Message.new(statement, options, Time.now - start_time)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: whi-cassie
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.
|
|
4
|
+
version: 1.3.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- We Heart It
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2022-05-
|
|
12
|
+
date: 2022-05-12 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: cassandra-driver
|