extendi-cassandra_object 1.0.10 → 1.0.11

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: ecd527d822a4895c5206c941bf16083025307c42
4
- data.tar.gz: 918d17478765af790449a2545818856358854e35
3
+ metadata.gz: 7f1757c6507b3cd8dee7f2abc12f0477c9c7d215
4
+ data.tar.gz: d0ddfe7860fee792792e11aaf1c73cf652fbb594
5
5
  SHA512:
6
- metadata.gz: d14760b8e19cfaf29a8b18822b37ba8e19140c3e679b35bd05425650f0c750180dd7428e544a98068d5c719241c5f0b61e2df5a89ab90ea29712f4062b92fe8a
7
- data.tar.gz: 700146529ef52a4046b0d7f39bdfedc2b09c3889f878a724bad17af14e00f113feb15977709eed4ecafb33f6a8414643c8a609b690b6861f9fbc8e0fcb051374
6
+ metadata.gz: 3b1a201f73f65278f1ec3b4ced3bbcd3839e4ff66e3ccb1e276e4394905d66a582897c72e34609f024737a740b18144322ca02d91459668e256a1b6f68cdfc3c
7
+ data.tar.gz: 947cb0f41a9908b036277d49b05c59fc71138bb6f20bdf27297b1ba16d6fe79568465416fba631b179f46ec693e2c235e6b545ed43e700977c265c49a4aaf3ec
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'extendi-cassandra_object'
5
- s.version = '1.0.10'
5
+ s.version = '1.0.11'
6
6
  s.description = 'Cassandra ActiveModel'
7
7
  s.summary = 'Cassandra ActiveModel'
8
8
  s.authors = ['Duccio Giovannelli', 'gotime']
@@ -45,7 +45,6 @@ module CassandraObject
45
45
  wheres << "#{@scope._key} = '#{id}'" if !id.nil?
46
46
  "WHERE #{wheres * ' AND '}" if wheres.any?
47
47
  end
48
-
49
48
  end
50
49
 
51
50
  def cassandra_cluster_options
@@ -99,16 +98,16 @@ module CassandraObject
99
98
 
100
99
  # Setting defaults
101
100
  cluster_options.merge!({
102
- heartbeat_interval: cluster_options[:heartbeat_interval] || 2,
101
+ heartbeat_interval: cluster_options.keys.include?(:heartbeat_interval) ? cluster_options[:heartbeat_interval] : 30,
103
102
  idle_timeout: cluster_options[:idle_timeout] || 60,
104
- consistency: cluster_options[:consistency] || :quorum,
103
+ max_schema_agreement_wait: 1,
104
+ consistency: cluster_options[:consistency] || :one,
105
105
  protocol_version: cluster_options[:protocol_version] || 3,
106
106
  page_size: cluster_options[:page_size] || 10000
107
107
  })
108
- return cluster_options
108
+ cluster_options
109
109
  end
110
110
 
111
-
112
111
  def connection
113
112
  @connection ||= begin
114
113
  cluster = Cassandra.cluster cassandra_cluster_options
@@ -95,7 +95,6 @@ module CassandraObject
95
95
  :idle_timeout
96
96
  ])
97
97
 
98
-
99
98
  {
100
99
  load_balancing_policy: 'Cassandra::LoadBalancing::Policies::%s',
101
100
  reconnection_policy: 'Cassandra::Reconnection::Policies::%s',
@@ -110,20 +109,19 @@ module CassandraObject
110
109
  end
111
110
  end
112
111
  end
113
-
112
+
114
113
  # Setting defaults
115
114
  cluster_options.merge!({
116
- heartbeat_interval: cluster_options[:heartbeat_interval] || 2,
115
+ heartbeat_interval: cluster_options.keys.include?(:heartbeat_interval) ? cluster_options[:heartbeat_interval] : 30,
117
116
  idle_timeout: cluster_options[:idle_timeout] || 60,
118
117
  max_schema_agreement_wait: 1,
119
- consistency: cluster_options[:consistency]||:quorum,
120
- protocol_version: cluster_options[:protocol_version]||3,
118
+ consistency: cluster_options[:consistency] || :one,
119
+ protocol_version: cluster_options[:protocol_version] || 3,
121
120
  page_size: cluster_options[:page_size] || 10000
122
121
  })
123
- return cluster_options
122
+ cluster_options
124
123
  end
125
124
 
126
-
127
125
  def connection
128
126
  @connection ||= begin
129
127
  cluster = Cassandra.cluster cassandra_cluster_options
@@ -7,10 +7,10 @@ module CassandraObject
7
7
  retries = 0
8
8
  begin
9
9
  super
10
- rescue Cassandra::Errors::NoHostsAvailable, Cassandra::Errors::IOError
10
+ rescue Cassandra::Errors::NoHostsAvailable, Cassandra::Errors::IOError, Cassandra::Errors::ClientError => e
11
11
  @connection = nil
12
12
  retries += 1
13
- retries < 2 ? retry : raise
13
+ retries < 10 ? retry : raise(e)
14
14
  end
15
15
  end
16
16
 
@@ -18,10 +18,11 @@ module CassandraObject
18
18
  retries = 0
19
19
  begin
20
20
  super
21
- rescue Cassandra::Errors::NoHostsAvailable, Cassandra::Errors::IOError
21
+ rescue Cassandra::Errors::NoHostsAvailable, Cassandra::Errors::IOError, Cassandra::Errors::ClientError => e
22
22
  @connection = nil
23
23
  retries += 1
24
- retries < 2 ? retry : raise
24
+ sleep 0.1
25
+ retries < 10 ? retry : raise(e)
25
26
  end
26
27
  end
27
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: extendi-cassandra_object
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.10
4
+ version: 1.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Duccio Giovannelli
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-08-02 00:00:00.000000000 Z
12
+ date: 2018-08-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel