use Redis for getting log

This commit is contained in:
Vokhmin Alexey V 2012-11-26 22:16:34 +04:00
parent c7ea2f7656
commit 96e8df1b50
2 changed files with 13 additions and 5 deletions

View File

@ -104,12 +104,16 @@ class Projects::BuildListsController < Projects::BaseController
end
def log
@log = `tail -n #{params[:load_lines].to_i} #{Rails.root + 'public' + @build_list.fs_log_path}`
@log = t("layout.build_lists.log.not_available") unless $?.success?
render :json => {
:log => @build_list.log,
:building => @build_list.build_started?
}
# @log = `tail -n #{params[:load_lines].to_i} #{Rails.root + 'public' + @build_list.fs_log_path}`
# @log = t("layout.build_lists.log.not_available") unless $?.success?
respond_to do |format|
format.json { render :json => { :log => @log, :building => @build_list.build_started? } }
end
# respond_to do |format|
# format.json { render :json => { :log => @log, :building => @build_list.build_started? } }
# end
end
def publish_build

View File

@ -345,6 +345,10 @@ class BuildList < ActiveRecord::Base
status == BUILD_PUBLISHED
end
def log
Resque.redis.get("abfworker::rpm-worker-#{id}") || ''
end
protected
def notify_users