nogara-redis_failover 0.9.7.2 → 0.9.7.3
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/lib/redis_failover/node_watcher.rb +6 -14
- data/lib/redis_failover/version.rb +1 -1
- metadata +1 -1
@@ -18,8 +18,6 @@ module RedisFailover
|
|
18
18
|
@node = node
|
19
19
|
@max_failures = max_failures
|
20
20
|
@monitor_thread = nil
|
21
|
-
@shutdown_lock = Mutex.new
|
22
|
-
@shutdown_cv = ConditionVariable.new
|
23
21
|
@done = false
|
24
22
|
end
|
25
23
|
|
@@ -34,15 +32,13 @@ module RedisFailover
|
|
34
32
|
|
35
33
|
# Performs a graceful shutdown of this watcher.
|
36
34
|
def shutdown
|
37
|
-
@
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
# best effort
|
43
|
-
end
|
44
|
-
@shutdown_cv.wait(@shutdown_lock)
|
35
|
+
@done = true
|
36
|
+
begin
|
37
|
+
@node.wakeup
|
38
|
+
rescue
|
39
|
+
# best effort
|
45
40
|
end
|
41
|
+
@monitor_thread.join
|
46
42
|
rescue => ex
|
47
43
|
logger.warn("Failed to gracefully shutdown watcher for #{@node}")
|
48
44
|
end
|
@@ -74,10 +70,6 @@ module RedisFailover
|
|
74
70
|
logger.error(ex.backtrace.join("\n"))
|
75
71
|
end
|
76
72
|
end
|
77
|
-
|
78
|
-
@shutdown_lock.synchronize do
|
79
|
-
@shutdown_cv.broadcast
|
80
|
-
end
|
81
73
|
end
|
82
74
|
|
83
75
|
# Notifies the manager of a node's state.
|