Skip to content

Commit

Permalink
refactor instance type count resetting
Browse files Browse the repository at this point in the history
  • Loading branch information
Eirik Dentz Sinclair & Noah Davis committed Apr 6, 2011
1 parent 8c8b933 commit dce25d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/oink/middleware.rb
Expand Up @@ -20,7 +20,6 @@ def call(env)
log_memory
log_activerecord
log_completed
reset_objects_instantiated
[status, headers, body]
end

Expand Down Expand Up @@ -48,13 +47,14 @@ def log_activerecord
sorted_list = Oink::HashUtils.to_sorted_array(ActiveRecord::Base.instantiated_hash)
sorted_list.unshift("Total: #{ActiveRecord::Base.total_objects_instantiated}")
@logger.info("Instantiation Breakdown: #{sorted_list.join(' | ')}")
reset_objects_instantiated
end
end

private

def reset_objects_instantiated
ActiveRecord::Base.reset_instance_type_count if @instruments.include?(:activerecord)
ActiveRecord::Base.reset_instance_type_count
end

end
Expand Down

0 comments on commit dce25d0

Please sign in to comment.