Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Improved overall memory usage/management by forking the worker proces…

…s and terminating at the end of each cycle.
  • Loading branch information...
commit c74a6ab9288de374616e2a39723be57bcb991cbf 1 parent 69f3720
@samsoir authored
Showing with 12 additions and 6 deletions.
  1. +12 −6 lib/daemon.rb
View
18 lib/daemon.rb
@@ -112,13 +112,19 @@ def daemonize
while true
- begin
- github_proc(@options)
- rescue => msg
- $stderr.puts "Encountered error:\n#{msg}"
+ raise RuntimeError,
+ "Failed to fork worker process" if (pid = fork) == -1
+
+ if pid.nil?
+ begin
+ github_proc(@options)
+ rescue => msg
+ $stderr.puts "Encountered error:\n#{msg}"
+ end
+ exit
+ else
+ sleep @options.frequency
end
-
- sleep @options.frequency
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.