Skip to content

Fix build_count memory leak#1407

Open
piccadilly-circus wants to merge 1 commit intomasterfrom
fix/build-count-memory-leak
Open

Fix build_count memory leak#1407
piccadilly-circus wants to merge 1 commit intomasterfrom
fix/build-count-memory-leak

Conversation

@piccadilly-circus
Copy link
Contributor

Summary

  • Changed .length to .count in build_count method (lib/travis/api/v3/renderer/repository.rb:41)
  • .length loads all build records into Ruby memory just to count them
  • .count runs a SELECT COUNT(*) in the database instead
  • This method is called on every repository page view and was contributing to travis-pro-api pods being OOMKilled

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant