priam 0.1.3 → 0.1.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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
@@ -9,8 +9,6 @@ module Priam::Command
9
9
  super_column = params[:super_column]
10
10
  name = params[:value_column]
11
11
  with_key_flag = params[:with_key_flag]
12
- weight_second = params[:weight_second]
13
- retry_max_count = params[:retry_max_count]
14
12
 
15
13
  client = Cassandra.new(keyspace, "#{host}:#{port}")
16
14
 
@@ -28,35 +26,21 @@ module Priam::Command
28
26
  next
29
27
  end
30
28
 
31
- retry_count = 0
32
- begin
33
- record = Priam.get_column(client, column_family, super_column, key, params)
29
+ record = Priam.get_column(client, column_family, super_column, key, params)
34
30
 
35
- if with_key_flag
36
- output_stream.print "#{key}\t"
37
- end
31
+ if with_key_flag
32
+ output_stream.print "#{key}\t"
33
+ end
38
34
 
39
- if name then
40
- output_stream.puts "#{record[name]}"
41
- else
42
- output_stream.puts record.to_json
43
- end
44
- count += 1
45
- if count % 10 == 0 then
46
- Priam.logger.info " GET [#{key_list.join(',')}]"
47
- key_list.clear
48
- end
49
- retry_count = 0
50
- rescue Exception=>e
51
- if retry_count < retry_max_count
52
- Priam.logger.warn("(EXCEPTION)#{e.message}(#{e.class.name}): #{e.backtrace.map{|s| " #{s}"}.join("\n")}")
53
- Priam.logger.warn("retry(#{retry_count})")
54
- retry_count += 1
55
- sleep(weight_second)
56
- retry
57
- else
58
- raise e
59
- end
35
+ if name then
36
+ output_stream.puts "#{record[name]}"
37
+ else
38
+ output_stream.puts record.to_json
39
+ end
40
+ count += 1
41
+ if count % 10 == 0 then
42
+ Priam.logger.info " GET [#{key_list.join(',')}]"
43
+ key_list.clear
60
44
  end
61
45
  end
62
46
 
@@ -2,7 +2,7 @@ module Priam::Core
2
2
  module Get
3
3
  def self.get_column(client, column_family, super_column, key, options={})
4
4
  raise_exception_flag = options[:raise_exception_flag]
5
- retry_max_count = options[:retry_max_count] || 0
5
+ retry_max_count = options[:retry_max_count] || 5
6
6
  weight_second = options[:weight_second] || 1
7
7
 
8
8
  retry_count = 0
@@ -17,14 +17,13 @@ module Priam::Core
17
17
  if raise_exception_flag then
18
18
  raise e
19
19
  else
20
- backtrace = e.backtrace.map{|s| " #{s}"}.join("\n")
21
- Priam.logger.warn(" #{e.message}(#{e.class.name}): #{backtrace}")
20
+ Priam.logger.warn("(EXCEPTION)#{e.message}(#{e.class.name}): #{e.backtrace.map{|s| " #{s}"}.join("\n")}")
22
21
  return {}
23
22
  end
24
23
  else
25
24
  retry_count += 1
26
- Priam.logger.warn(" #{e.message}(#{e.class.name})")
27
- Priam.logger.info(" retry(#{retry_count})")
25
+ Priam.logger.warn("(EXCEPTION)#{e.message}(#{e.class.name}): #{e.backtrace.map{|s| " #{s}"}.join("\n")}")
26
+ Priam.logger.warn("retry(#{retry_count})")
28
27
  sleep(weight_second) if weight_second
29
28
  retry
30
29
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "priam"
8
- s.version = "0.1.3"
8
+ s.version = "0.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kenji Hara"]
12
- s.date = "2013-03-27"
12
+ s.date = "2013-03-28"
13
13
  s.description = "Command-base client for Cassandra."
14
14
  s.email = "haracane@gmail.com"
15
15
  s.executables = ["priam"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: priam
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kenji Hara
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-03-27 00:00:00 Z
18
+ date: 2013-03-28 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  requirement: &id001 !ruby/object:Gem::Requirement