Skip to content

Commit

Permalink
Fix broken unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JimGochee committed Jul 25, 2008
1 parent cd70ea0 commit 07477ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/newrelic/agent/agent.rb
Expand Up @@ -652,7 +652,7 @@ def invoke_remote(method, *args)
# send the given message to STDERR as well as the agent log, so that it shows
# up in the console. This should be used for important informational messages at boot
def log!(msg, level = :info)
to_stderr "[#{Time.now.strftime("%m/%d/%y %H:%M:%S")} (#{$$})] #{level} : #{msg}\n"
to_stderr msg
log.send level, msg if log
end

Expand All @@ -665,7 +665,7 @@ def to_stderr(msg)
end

def graceful_disconnect
if @connected # && remote_host != "localhost"
if @connected && !(remote_host == "localhost" && @port == 3000)
begin
log.info "Sending graceful shutdown message to #{remote_host}:#{remote_port}"

Expand Down
8 changes: 6 additions & 2 deletions lib/newrelic/agent/worker_loop.rb
Expand Up @@ -65,10 +65,14 @@ def run_next_task
# sleep until this next task's scheduled invocation time
sleep_time = task.next_invocation_time - Time.now

sleep_time.to_i.times do
sleep 1
# sleep in chunks no longer than 1 second
while sleep_time > 0

sleep (sleep_time > 1 ? 1 : sleep_time)

return if !@should_run

sleep_time -= 1
end

begin
Expand Down

0 comments on commit 07477ef

Please sign in to comment.