mutle-neighborhoodwatch-agent 0.0.1 → 0.0.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.
- data/.gitignore +1 -0
- data/lib/neighborhoodwatch-agent.rb +3 -1
- data/neighborhoodwatch-agent.gemspec +1 -1
- metadata +1 -1
data/.gitignore
CHANGED
@@ -6,6 +6,7 @@ module NeighborhoodWatch
|
|
6
6
|
|
7
7
|
TIMEOUT = 20
|
8
8
|
SERVER = "beta.neighborhoodwat.ch"
|
9
|
+
OK_STATUS = [200, 301, 302]
|
9
10
|
|
10
11
|
def self.run
|
11
12
|
EventMachine.run {
|
@@ -34,6 +35,7 @@ module NeighborhoodWatch
|
|
34
35
|
|
35
36
|
multi = EventMachine::MultiRequest.new
|
36
37
|
site_requests = []
|
38
|
+
puts sites.inspect
|
37
39
|
sites.each do |site|
|
38
40
|
req = EventMachine::HttpRequest.new(site['url']).get(:timeout => TIMEOUT)
|
39
41
|
multi.add(req); site_requests << req
|
@@ -42,7 +44,7 @@ module NeighborhoodWatch
|
|
42
44
|
status = {}
|
43
45
|
multi.responses[:succeeded].each do |resp|
|
44
46
|
site = sites[site_requests.index(resp)]
|
45
|
-
if resp.response_header.status
|
47
|
+
if OK_STATUS.include?(resp.response_header.status)
|
46
48
|
status[site['id']] = "up"
|
47
49
|
else
|
48
50
|
status[site['id']] = "error-#{resp.response_header.status}"
|