Arthur Clement
2010-Jul-21 09:27 UTC
[Ovirt-devel] [PATCH] Get timestamp at check_heartbeat to avoid time lag
Avoid time lag and disconnection after several checks Signed-off-by: Arthur Clement <aclement at linagora.com> --- src/host-browser/host-register.rb | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/host-browser/host-register.rb b/src/host-browser/host-register.rb index e49f08e..693a6f2 100755 --- a/src/host-browser/host-register.rb +++ b/src/host-browser/host-register.rb @@ -178,6 +178,7 @@ class HostRegister < Qmf::ConsoleHandler def agent_disconnected(agent) synchronize do debugputs "Marking objects for agent #{agent.key} inactive" + @logger.info "Marking objects for agent #{agent.key} inactive" @cached_hosts.keys.each do |objkey| if @cached_hosts[objkey][:agent_key] == agent.key cached_host = @cached_hosts[objkey] @@ -435,10 +436,10 @@ class HostRegister < Qmf::ConsoleHandler while true sleep(5) synchronize do - # Get seconds from the epoch - t = Time.new.to_i @heartbeats.keys.each do | key | + # Get seconds from the epoch + t = Time.new.to_i agent, timestamp = @heartbeats[key] # Heartbeats from qpid are in microseconds, we just need seconds.. @@ -447,7 +448,7 @@ class HostRegister < Qmf::ConsoleHandler if delta > 30 # No heartbeat for 30 seconds.. deal with dead/disconnected agent. - debugputs "Agent #{key} timed out!" + @logger.info "Agent #{key} timed out! Check NTP || with delta #{delta} = t #{t} - s #{s}" @heartbeats.delete(key) agent_disconnected(agent) -- 1.7.1
Arthur Clément
2010-Aug-18 13:37 UTC
[Ovirt-devel] [PATCH] Get timestamp at check_heartbeat to avoid time lag
pushed (Wed Jul 21) On mercredi 21 juillet 2010 11:27:14 Arthur Clement wrote:> Avoid time lag and disconnection after several checks > > Signed-off-by: Arthur Clement <aclement at linagora.com> > --- > src/host-browser/host-register.rb | 7 ++++--- > 1 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/src/host-browser/host-register.rb > b/src/host-browser/host-register.rb index e49f08e..693a6f2 100755 > --- a/src/host-browser/host-register.rb > +++ b/src/host-browser/host-register.rb > @@ -178,6 +178,7 @@ class HostRegister < Qmf::ConsoleHandler > def agent_disconnected(agent) > synchronize do > debugputs "Marking objects for agent #{agent.key} inactive" > + @logger.info "Marking objects for agent #{agent.key} inactive" > @cached_hosts.keys.each do |objkey| > if @cached_hosts[objkey][:agent_key] == agent.key > cached_host = @cached_hosts[objkey] > @@ -435,10 +436,10 @@ class HostRegister < Qmf::ConsoleHandler > while true > sleep(5) > synchronize do > - # Get seconds from the epoch > - t = Time.new.to_i > > @heartbeats.keys.each do | key | > + # Get seconds from the epoch > + t = Time.new.to_i > agent, timestamp = @heartbeats[key] > > # Heartbeats from qpid are in microseconds, we > just need seconds.. @@ -447,7 +448,7 @@ class HostRegister < > Qmf::ConsoleHandler > > if delta > 30 > # No heartbeat for 30 seconds.. deal with > dead/disconnected agent. - debugputs "Agent > #{key} timed out!" > + @logger.info "Agent #{key} timed out! Check > NTP || with delta #{delta} = t #{t} - s #{s}" @heartbeats.delete(key) > > agent_disconnected(agent)-- Arthur CLEMENT Linagora Paris