Commit fe934a2d authored by tiagonbotelho's avatar tiagonbotelho Committed by Yorick Peterse

adds cache to languages list

parent 73535b80
......@@ -948,10 +948,10 @@ class Project < ActiveRecord::Base
def main_language
if !empty_repo?
languages = Linguist::Repository.new(
@repository.rugged,
@repository.rugged.head.target_id).languages
return languages.key(languages.values.max)
Rails.cache.fetch([self, "language"]) do
languages = Linguist::Repository.new(@repository.rugged, @repository.rugged.head.target_id).languages
languages.key(languages.values.max)
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment