whi-cassie 1.3.2 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY.md +9 -0
  3. data/VERSION +1 -1
  4. data/lib/cassie.rb +11 -3
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c87e681cda4e500a2f9cb34eee05a806525cce81305f2732ff6b33bd9c13170
4
- data.tar.gz: 4edfe67aa1bba47bac102cd3b1b181240bab73469e45d16c0a1cc922467c74e8
3
+ metadata.gz: da71885a1923c8c8d801ae3312151406ec78630237c43f9057c4abc6970626cd
4
+ data.tar.gz: a4ac1795d699b89efac12f4c5455d84095dacfe07d5634754a3ac8e129d8553f
5
5
  SHA512:
6
- metadata.gz: 8b1e1b1e0f674740d0f217a608ae1f024fff3c2529b6a29028b46cb6cbbbc6a077c2dc0b4fb8e2c0b0fa5dd6fa6cc233df74c76ce302378a738583c2fa3ea6a6
7
- data.tar.gz: e192c9f23cd323468b47dbc20762e63dc891c6837e6863eb56ea2abee7611d5b50289795dc9da5b6061c9b62495833df5c61599ff7feec15ca00a31a89dbee83
6
+ metadata.gz: 55c5506a91a5a6cc353d64ca12a0a57bb6cd691a1f4314e257fc468cfb0bdd12b60a590a1663a2cd3b200ca9da8891c80de6cd43c4b0fc12910ca155a96cead3
7
+ data.tar.gz: 07463a9d5b35522559405d8c94f35cd4c922e2c59e7bf62fc2cc99a91d3ff22503f9900ece00fa4ffec0d050fa5c2712b8da90b150b99d6b6eb6a0c6f02bcc00
data/HISTORY.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 1.3.4
2
+
3
+ * Fix syntax error.
4
+
5
+ ## 1.3.3 (yanked)
6
+
7
+ * Restore automatic reconnect on dead connections.
8
+ * Handle race condition on reconnect logic.
9
+
1
10
  ## 1.3.2
2
11
 
3
12
  * Improved synchronization on reconnect logic.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.2
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&.close
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
- disconnect
132
+ existing_session = @session
131
133
  @monitor.synchronize do
132
- connect unless connected?
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.2
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-10 00:00:00.000000000 Z
12
+ date: 2022-05-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cassandra-driver