lib/sidekiq/web/application.rb in sidekiq-4.2.1 vs lib/sidekiq/web/application.rb in sidekiq-4.2.2
- old
+ new
@@ -5,11 +5,11 @@
extend WebRouter
CONTENT_LENGTH = "Content-Length".freeze
CONTENT_TYPE = "Content-Type".freeze
REDIS_KEYS = %w(redis_version uptime_in_days connected_clients used_memory_human used_memory_peak_human)
- NOT_FOUND = [404, {"Content-Type" => "text/plain", "X-Cascade" => "pass" }, ["Not Found"]]
+ NOT_FOUND = [404, {"Content-Type" => "text/plain", "X-Cascade" => "pass" }.freeze, ["Not Found"]]
def initialize(klass)
@klass = klass
end
@@ -26,10 +26,14 @@
end
def self.set(key, val)
# nothing, backwards compatibility
end
+
+ get "" do
+ redirect(root_path)
+ end
get "/" do
@redis_info = redis_info.select{ |k, v| REDIS_KEYS.include? k }
stats_history = Sidekiq::Stats::History.new((params['days'] || 30).to_i)
@processed_history = stats_history.processed
@@ -287,9 +291,11 @@
WebAction::TEXT_HTML
end
[200, type_header, [resp]]
end
+
+ resp[1] = resp[1].dup
resp[1][CONTENT_LENGTH] = resp[2].inject(0) { |l, p| l + p.bytesize }.to_s
resp
end