OSDN Git Service

Prevent 500 on project home page if project has extremely huge number of commits
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Mon, 12 Aug 2013 19:23:01 +0000 (22:23 +0300)
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Mon, 12 Aug 2013 19:23:01 +0000 (22:23 +0300)
app/models/repository.rb

index a2fd91b..3d64951 100644 (file)
@@ -105,7 +105,11 @@ class Repository
 
   def commit_count
     Rails.cache.fetch(cache_key(:commit_count)) do
-      raw_repository.raw.commit_count
+      begin
+        raw_repository.raw.commit_count
+      rescue
+        0
+      end
     end
   end