From 772480ad212368ddf87df278b8058bdd49b7c110 Mon Sep 17 00:00:00 2001 From: Piccadily Circus Date: Fri, 6 Mar 2026 15:12:53 +0500 Subject: [PATCH] Fix build_count to use SQL count instead of loading all records Changed .length to .count in build_count method. Using .length loads all build records into memory just to count them, which wastes memory and contributes to pod OOM issues. Using .count runs a simple SELECT COUNT(*) query in the database instead. --- lib/travis/api/v3/renderer/repository.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/travis/api/v3/renderer/repository.rb b/lib/travis/api/v3/renderer/repository.rb index 38dbb4483..6793a2831 100644 --- a/lib/travis/api/v3/renderer/repository.rb +++ b/lib/travis/api/v3/renderer/repository.rb @@ -38,7 +38,7 @@ def default_branch end def build_count - model.builds.where.not(event_type: :pull_request).length + model.builds.where.not(event_type: :pull_request).count end def current_build