diff options
author | Patrick J Cherry <patrick@bytemark.co.uk> | 2011-08-19 10:23:01 +0100 |
---|---|---|
committer | Patrick J Cherry <patrick@bytemark.co.uk> | 2011-08-19 10:23:01 +0100 |
commit | c1cf28d9dcc63622b5df1caeab3a2baf66811443 (patch) | |
tree | 1bde7a1aac62472f73740657bfe77a01184e534c /lib/mauve/server.rb | |
parent | 3455b9a9f195e273e574989a0845ad8d2065e82f (diff) |
Added last_state_changed thing for MauveThread. Closes #1836.
Diffstat (limited to 'lib/mauve/server.rb')
-rw-r--r-- | lib/mauve/server.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/mauve/server.rb b/lib/mauve/server.rb index eb5872b..3d59049 100644 --- a/lib/mauve/server.rb +++ b/lib/mauve/server.rb @@ -103,7 +103,7 @@ module Mauve end def start - self.state = :starting +# self.state = :starting self.setup @@ -123,6 +123,14 @@ module Mauve # thread_list.delete(klass.instance.thread) + # + # Make sure that if the thread is frozen, that we've not been frozen for too long. + # + if klass.instance.state != :started and klass.instance.last_state_change.is_a?(Time) and klass.instance.last_state_change < (Time.now - 2.minutes) + logger.warn "#{klass} has been #{klass.instance.state} since #{klass.instance.last_state_change}. Killing and restarting." + klass.instance.stop + end + # # Do nothing if we're frozen or supposed to be stopping or still alive! # |