time_bandits 0.2.1 → 0.2.2

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.
@@ -18,7 +18,15 @@ module TimeBandits
18
18
  require 'time_bandits/monkey_patches/active_record'
19
19
  TimeBandits.add TimeBandits::TimeConsumers::Database
20
20
  end
21
+
22
+ # reset statistics info, so that for example the time for the first request handled
23
+ # by the dispatcher is correct.
24
+ app.config.after_initialize do
25
+ TimeBandits.reset
26
+ end
27
+
21
28
  end
22
29
 
23
30
  end
31
+
24
32
  end
@@ -8,7 +8,7 @@ module TimeBandits
8
8
  end
9
9
 
10
10
  def initialize
11
- GC.enable_stats
11
+ enable_stats
12
12
  reset
13
13
  end
14
14
  private :initialize
@@ -17,6 +17,15 @@ module TimeBandits
17
17
  @instance ||= new
18
18
  end
19
19
 
20
+ def enable_stats
21
+ GC.enable_stats
22
+ if defined?(PhusionPassenger)
23
+ PhusionPassenger.on_event(:starting_worker_process) do |forked|
24
+ GC.enable_stats if forked
25
+ end
26
+ end
27
+ end
28
+
20
29
  if GC.respond_to? :heap_slots
21
30
 
22
31
  def reset
@@ -1,3 +1,3 @@
1
1
  module TimeBandits
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: time_bandits
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 1
10
- version: 0.2.1
9
+ - 2
10
+ version: 0.2.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Stefan Kaes
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-04-10 00:00:00 +02:00
18
+ date: 2012-04-20 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency