aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorrhenium <re4k@re4k.info>2013-06-03 04:31:08 +0900
committerrhenium <re4k@re4k.info>2013-06-03 04:31:08 +0900
commit9265d36c35f811ce6645ec259fbcfcff6e52d4e2 (patch)
tree6bbda607557d2b466e49cfc986808b006a0c6cb0 /lib
parent12db5252ddf61872411712d0992fc8b2cf82fcdd (diff)
downloadaclog-9265d36c35f811ce6645ec259fbcfcff6e52d4e2.tar.gz
cleanup
Diffstat (limited to 'lib')
-rw-r--r--lib/aclog/constants.rb4
-rw-r--r--lib/unicorn_killer.rb54
2 files changed, 0 insertions, 58 deletions
diff --git a/lib/aclog/constants.rb b/lib/aclog/constants.rb
index d6cca67..8d07d46 100644
--- a/lib/aclog/constants.rb
+++ b/lib/aclog/constants.rb
@@ -4,9 +4,5 @@ module Aclog
RESOLVED = 0
PENDING = 1
end
-
- module IssueType
- TWEET_STOLEN = 0
- end
end
end
diff --git a/lib/unicorn_killer.rb b/lib/unicorn_killer.rb
deleted file mode 100644
index afec273..0000000
--- a/lib/unicorn_killer.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-# https://gist.github.com/hotchpotch/1258681
-# # your config.ru
-# require 'unicorn_killer'
-# use UnicornKiller::MaxRequests, 1000
-# use UnicornKiller::Oom, 400 * 1024
-
-module UnicornKiller
- module Kill
- def quit
- sec = (Time.now - @process_start).to_i
- warn "#{self.class} send SIGQUIT (pid: #{Process.pid})\talive: #{sec} sec"
- Process.kill :QUIT, Process.pid
- end
- end
-
- class Oom
- include Kill
-
- def initialize(app, memory_size= 512 * 1024, check_cycle = 10)
- @app = app
- @memory_size = memory_size
- @check_cycle = check_cycle
- @check_count = 0
- end
-
- def rss
- `ps -o rss= -p #{Process.pid}`.to_i
- end
-
- def call(env)
- @process_start ||= Time.now
- if (@check_count += 1) % @check_cycle == 0
- @check_count = 0
- quit if rss > @memory_size
- end
- @app.call env
- end
- end
-
- class MaxRequests
- include Kill
-
- def initialize(app, max_requests = 1000)
- @app = app
- @max_requests = max_requests
- end
-
- def call(env)
- @process_start ||= Time.now
- quit if (@max_requests -= 1) == 0
- @app.call env
- end
- end
-end