timberline 0.4.0 → 0.4.1

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: 01da0a8b72d0153c044386ba5d2a2947ceba809a
4
- data.tar.gz: b56730906aa005b6107cea4f1c693362e8a1ee99
3
+ metadata.gz: 9b3f445273cef8a33fd4137ad6cffdb91c5af8f5
4
+ data.tar.gz: 049bab1a641c24643642554ee8f1c89e4fd9c78c
5
5
  SHA512:
6
- metadata.gz: e997f4fc10c86d1c64f2f4a18982e1fa9a2a30042d078988c3db13b1f675f7ca5260bad1b45a9b75b055292ff5e0a8d712e0fc7fe5e9ab0804d417510d0b71a2
7
- data.tar.gz: a4c464628b537811773da27a6f95828bba46566b23bd53bfec452d17497dd99a464ef8c7adb3373df1f0ee4fd1d5534e42cbc9de8fb6a3ac18b860c4be747e7e
6
+ metadata.gz: cb803ba88627fffc8e1af3ec9253733b584601397fd08d3701e02ace865a0887c9ac0219da754ff4539d0798f923f9c653db8d28e1711b94371f0ffb437b6bdc
7
+ data.tar.gz: 9d17830ab88a54d2bdde1fe6f0ea02fad125570bf36a9b03bb7aebde17c75a23e21b371df967cb010912a5769eaa66524cd405e22b20b938e8a1ba91799dd6b0
data/README.markdown CHANGED
@@ -101,7 +101,7 @@ queue (more on that later). There are 3 ways to configure Timberline:
101
101
  To push a job onto the queue you'll want to make use of the `Timberline#push`
102
102
  method, like so:
103
103
 
104
- Timberline.push "queue_name", data, { :other_data => some_stuff }
104
+ Timberline.push "queue_name", data, { other_data: some_stuff }
105
105
 
106
106
  `queue_name` is the name of the queue you want to push data onto; data is the
107
107
  data you want to push onto the queue (remember that this all gets converted to
data/Rakefile CHANGED
@@ -4,4 +4,4 @@ require 'rspec/core/rake_task'
4
4
 
5
5
  RSpec::Core::RakeTask.new(:spec)
6
6
 
7
- task :default => :spec
7
+ task default: :spec
data/bin/timberline CHANGED
@@ -15,10 +15,10 @@ Usage:
15
15
  where [options] are:
16
16
  EOS
17
17
 
18
- opt :daemonize, "Run the queue listener as a daemon", :default => false
19
- opt :log_output, "log the output to <filename>.output (only applicable in conjunction with the daemonize option)", :default => false
18
+ opt :daemonize, "Run the queue listener as a daemon", default: false
19
+ opt :log_output, "log the output to <filename>.output (only applicable in conjunction with the daemonize option)", default: false
20
20
  opt :config, "YAML config file to set up Timberline options",
21
- :type => String, :default => nil
21
+ type: String, default: nil
22
22
  end
23
23
 
24
24
  unless opts[:config].nil?
@@ -30,7 +30,7 @@ timberline_spec = File.read(timberline_file)
30
30
 
31
31
  if opts[:daemonize]
32
32
  puts "Entering daemon mode"
33
- Daemons.daemonize({ :app_name => timberline_file, :log_output => opts[:log_output] })
33
+ Daemons.daemonize({ app_name: timberline_file, log_output: opts[:log_output] })
34
34
  end
35
35
 
36
36
  puts "Listening..."
@@ -28,7 +28,7 @@ class Timberline
28
28
  def redis_config
29
29
  config = {}
30
30
 
31
- { :db => database, :host => host, :port => port, :timeout => timeout, :password => password, :logger => logger }.each do |name, value|
31
+ { db: database, host: host, port: port, timeout: timeout, password: password, logger: logger }.each do |name, value|
32
32
  config[name] = value unless value.nil?
33
33
  end
34
34
 
@@ -33,7 +33,7 @@ class Timberline
33
33
  private
34
34
 
35
35
  def build_envelope_hash
36
- { :contents => contents }.merge(@metadata)
36
+ { contents: contents }.merge(@metadata)
37
37
  end
38
38
 
39
39
  def assign_var(name, value)
@@ -75,8 +75,21 @@ class Timberline
75
75
 
76
76
  def average_execution_time
77
77
  successes = Timberline.redis.xmembers(attr("success_stats")).map { |item| Envelope.from_json(item)}
78
- times = successes.map { |item| item.finished_processing_at.to_f - item.started_processing_at.to_f }
79
- times.inject(0, :+) / times.size.to_f
78
+ times = successes.map do |item|
79
+ if item.finished_processing_at
80
+ item.finished_processing_at.to_f - item.started_processing_at.to_f
81
+ elsif item.fatal_error_at
82
+ item.fatal_error_at.to_f - item.started_processing_at.to_f
83
+ else
84
+ nil
85
+ end
86
+ end
87
+ times.reject! { |t| t.nil? }
88
+ if times.size == 0
89
+ 0
90
+ else
91
+ times.inject(0, :+) / times.size.to_f
92
+ end
80
93
  end
81
94
 
82
95
  def add_retry_stat(item)
@@ -1,3 +1,3 @@
1
1
  class Timberline
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
data/lib/timberline.rb CHANGED
@@ -20,7 +20,7 @@ class Timberline
20
20
  def self.redis=(server)
21
21
  initialize_if_necessary
22
22
  if server.is_a? Redis
23
- @redis = Redis::Namespace.new(@config.namespace, :redis => server)
23
+ @redis = Redis::Namespace.new(@config.namespace, redis: server)
24
24
  elsif server.is_a? Redis::Namespace
25
25
  @redis = server
26
26
  elsif server.nil?
@@ -1,12 +1,12 @@
1
1
  module SpecSupport
2
2
  module FakeRails
3
3
  def self.create_fake_env
4
- fake_rails = OpenStruct.new(:root => File.join(File.dirname(File.path(__FILE__)), "..", "fake_rails"), :env => "development")
4
+ fake_rails = OpenStruct.new(root: File.join(File.dirname(File.path(__FILE__)), "..", "fake_rails"), env: "development")
5
5
  Object.send(:const_set, :Rails, fake_rails)
6
6
  end
7
7
 
8
8
  def self.create_fake_env_without_config
9
- fake_rails = OpenStruct.new(:root => File.join(File.dirname(File.path(__FILE__)), "..", "gibberish"), :env => "development")
9
+ fake_rails = OpenStruct.new(root: File.join(File.dirname(File.path(__FILE__)), "..", "gibberish"), env: "development")
10
10
  Object.send(:const_set, :Rails, fake_rails)
11
11
  end
12
12
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timberline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tommy Morgan