nerve 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nerve (0.5.1)
4
+ nerve (0.5.2)
5
5
  bunny (= 1.1.0)
6
6
  zk (~> 1.9.2)
7
7
 
data/lib/nerve.rb CHANGED
@@ -30,6 +30,10 @@ module Nerve
30
30
  @services = opts['services']
31
31
  @watchers = {}
32
32
 
33
+ # Any exceptions in the watcher threads should wake the main thread so
34
+ # that we can fail fast.
35
+ Thread.abort_on_exception = true
36
+
33
37
  log.debug 'nerve: completed init'
34
38
  end
35
39
 
@@ -43,7 +47,7 @@ module Nerve
43
47
  begin
44
48
  sleep
45
49
  rescue StandardError => e
46
- log.error 'nerve: encountered unexpected exception #{e.inspect} in main thread'
50
+ log.error "nerve: encountered unexpected exception #{e.inspect} in main thread"
47
51
  raise e
48
52
  ensure
49
53
  $EXIT = true
@@ -10,6 +10,9 @@ class Nerve::Reporter
10
10
  def start
11
11
  end
12
12
 
13
+ def stop
14
+ end
15
+
13
16
  def report_up
14
17
  end
15
18
 
@@ -21,6 +21,11 @@ class Nerve::Reporter
21
21
  log.info "nerve: successfully created zk connection to #{@path}"
22
22
  end
23
23
 
24
+ def stop()
25
+ log.info "nerve: closing zk connection at #{@path}"
26
+ @zk.close
27
+ end
28
+
24
29
  def report_up()
25
30
  zk_save
26
31
  end
@@ -72,11 +72,12 @@ module Nerve
72
72
  sleep @check_interval
73
73
  end
74
74
  rescue StandardError => e
75
- log.error "nerve: error in service watcher #{@name}: #{e}"
75
+ log.error "nerve: error in service watcher #{@name}: #{e.inspect}"
76
76
  raise e
77
77
  ensure
78
78
  log.info "nerve: ending service watch #{@name}"
79
79
  $EXIT = true
80
+ @reporter.stop
80
81
  end
81
82
 
82
83
  def check?
data/lib/nerve/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Nerve
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nerve
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-03-05 00:00:00.000000000 Z
14
+ date: 2014-03-06 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: zk