lockistics 0.1.4 → 0.1.5

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.
@@ -117,7 +117,8 @@ module Lockistics
117
117
  end
118
118
 
119
119
  def before_perform
120
- Lockistics.known_keys(key) unless options[:no_metrics]
120
+ return nil if options[:no_metrics]
121
+ Lockistics.known_keys(key)
121
122
  @start_time = Time.now.to_f
122
123
  # Sometimes you get 'Cannot allocate memory - ps -o rss= -p 15964'
123
124
  begin
@@ -133,12 +134,13 @@ module Lockistics
133
134
  end
134
135
 
135
136
  def after_perform
137
+ return nil if options[:no_metrics]
136
138
  unless @lock_timeouts > 0
137
139
  @duration = ((Time.now.to_f - @start_time) * 1000).round
138
140
  @rss_increase = ((OS.rss_bytes - @start_rss) / 1024).round unless @start_rss.nil?
139
141
  end
140
142
  add_meter_statistics unless options[:no_metrics]
141
- add_lock_statistics unless lock.nil?
143
+ add_lock_statistics unless lock.nil?
142
144
  end
143
145
 
144
146
  def add_meter_statistics
@@ -1,3 +1,3 @@
1
1
  module Lockistics
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
data/spec/locking_spec.rb CHANGED
@@ -50,4 +50,13 @@ describe "Lockistics.lock" do
50
50
  Lockistics.release("ltest1")
51
51
  Lockistics.release("ltest2")
52
52
  end
53
+
54
+ it "should not collect metrics when locking only" do
55
+ Lockistics.lock("ltest1", :wait => false, :raise => false, :expire => 100) do
56
+ #
57
+ end
58
+ stats = Lockistics.statistics("ltest1")
59
+ Lockistics.redis.keys(Lockistics.configuration.namespace + ".ltest1*").should be_empty
60
+ stats.daily.should be_empty
61
+ end
53
62
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lockistics
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 4
10
- version: 0.1.4
9
+ - 5
10
+ version: 0.1.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kimmo Lehto
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2014-06-05 00:00:00 Z
18
+ date: 2014-06-14 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement