Remove unused code
This commit is contained in:
parent
227a664e5e
commit
95ecbfed50
1 changed files with 10 additions and 39 deletions
|
@ -1,35 +1,3 @@
|
||||||
module ActiveRecord
|
|
||||||
class QueryRecorder
|
|
||||||
attr_reader :log
|
|
||||||
attr_reader :start
|
|
||||||
attr_reader :end
|
|
||||||
|
|
||||||
def initialize(&block)
|
|
||||||
@log = []
|
|
||||||
@start = Time.now
|
|
||||||
ActiveSupport::Notifications.subscribed(method(:callback), 'sql.active_record', &block)
|
|
||||||
@end = Time.now
|
|
||||||
end
|
|
||||||
|
|
||||||
def callback(name, start, finish, message_id, values)
|
|
||||||
return if %w(SCHEMA).include?(values[:name])
|
|
||||||
@log << values[:sql]
|
|
||||||
end
|
|
||||||
|
|
||||||
def time
|
|
||||||
@end - @start
|
|
||||||
end
|
|
||||||
|
|
||||||
def count
|
|
||||||
@log.count
|
|
||||||
end
|
|
||||||
|
|
||||||
def log_message
|
|
||||||
@log.join("\n\n")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
class Projects::PipelinesController < Projects::ApplicationController
|
class Projects::PipelinesController < Projects::ApplicationController
|
||||||
before_action :pipeline, except: [:index, :new, :create, :charts]
|
before_action :pipeline, except: [:index, :new, :create, :charts]
|
||||||
before_action :commit, only: [:show, :builds]
|
before_action :commit, only: [:show, :builds]
|
||||||
|
@ -61,15 +29,18 @@ class Projects::PipelinesController < Projects::ApplicationController
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.json do
|
format.json do
|
||||||
result = nil
|
render json: {
|
||||||
queries = ActiveRecord::QueryRecorder.new do
|
pipelines: PipelineSerializer
|
||||||
result = PipelineSerializer
|
|
||||||
.new(project: @project, user: @current_user)
|
.new(project: @project, user: @current_user)
|
||||||
.with_pagination(request, response)
|
.with_pagination(request, response)
|
||||||
.represent(@pipelines)
|
.represent(@pipelines),
|
||||||
end
|
count: {
|
||||||
|
all: @pipelines_count,
|
||||||
render json: { aa_queries: queries.count, aa_time: queries.time, result: result }
|
running: @running_count,
|
||||||
|
pending: @pending_count,
|
||||||
|
finished: @finished_count,
|
||||||
|
}
|
||||||
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue