okcomputer 1.5.1 → 1.6.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 57a1101b6bb68405d1d78f005d27659a05023415
4
- data.tar.gz: 4ffbb6650f2d992136a48b6d1a93286b1143de2c
3
+ metadata.gz: ba26aa7d1aae0bf9b154790df6ba99e372d0f606
4
+ data.tar.gz: 7db32126e1e5b5fde960295be65164932527a058
5
5
  SHA512:
6
- metadata.gz: 7955d8588e2a736f3bcfdbdd2de5833c1430ac2284a1aa4c197f55994fc388608db34627e2c400be69dac9d2e969e17ecf180da00523ad6065206a048bf1272a
7
- data.tar.gz: fe28600d47e2e29636e71e26bcd871365f1385ad3c3da8a63540fa2e18b8a488190dbd398b8ec98e6aa6d4e1cfd130da0cd2139292e912499b4cee03797b76cd
6
+ metadata.gz: 667ec6c4c321a586c276389960bb77b65bc1a21780b90c4fd451a394762bd27cb897dd4da0db97883ca7f32a1219a939650bebee509872474efed8693e9b3e52
7
+ data.tar.gz: f5d736b22f60ddd1cdd8e0c2b1c2216289af0eccbf5446280e242d00d7c23c9375576bf3c1431edaf4e37419b1e4866dd4a62d12fbae3211c67b29265209115f
data/README.markdown CHANGED
@@ -119,6 +119,15 @@ end
119
119
  OkComputer::Registry.register "check_for_odds", MyCustomCheck.new
120
120
  ```
121
121
 
122
+ ## Running checks in parallel
123
+
124
+ By default, OkComputer runs checks in sequence. If you'd like to run them in parallel, you can configure it with:
125
+
126
+ ```ruby
127
+ # config/initializers/okcomputer.rb
128
+ OkComputer.check_in_parallel = true
129
+ ```
130
+
122
131
  ## Performing Checks
123
132
 
124
133
  * Perform a simple up check: http://example.com/okcomputer
@@ -150,4 +159,3 @@ OkComputer.analytics_ignore = false
150
159
  5. Create new Pull Request
151
160
 
152
161
  [fitter-happier]:https://rubygems.org/gems/fitter-happier
153
-
@@ -12,7 +12,7 @@ module OkComputer
12
12
 
13
13
  # Public: Run the registry's checks
14
14
  def run
15
- checks.each(&:run)
15
+ OkComputer.check_in_parallel ? check_in_parallel : check_in_sequence
16
16
  end
17
17
 
18
18
  # Public: The list of checks in the collection
@@ -48,5 +48,18 @@ module OkComputer
48
48
  def success?
49
49
  checks.all?(&:success?)
50
50
  end
51
+
52
+ private
53
+
54
+ def check_in_sequence
55
+ checks.each(&:run)
56
+ end
57
+
58
+ def check_in_parallel
59
+ threads = checks.map do |check|
60
+ Thread.new { check.run }
61
+ end
62
+ threads.each(&:join)
63
+ end
51
64
  end
52
65
  end
@@ -45,6 +45,10 @@ module OkComputer
45
45
  mattr_accessor :mount_at
46
46
  self.mount_at = 'okcomputer'
47
47
 
48
+ # Public: whether to execute checks in parallel.
49
+ mattr_accessor :check_in_parallel
50
+ self.check_in_parallel = false
51
+
48
52
  # Public: Option to disable third-party app performance tools (.e.g NewRelic) from counting OkComputer routes towards their total.
49
53
  mattr_accessor :analytics_ignore
50
54
  self.analytics_ignore = true
@@ -1,3 +1,3 @@
1
1
  module OkComputer
2
- VERSION = "1.5.1"
2
+ VERSION = '1.6.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: okcomputer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Byrne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-21 00:00:00.000000000 Z
11
+ date: 2015-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sqlite3