• Yorick Peterse's avatar
    Use arrays in Pipeline#latest_builds_with_artifacts · 54f1e406
    Yorick Peterse authored
    This changes Ci::Pipeline#latest_builds_with_artifacts so it returns an
    Array instead of a relation. Whenever we use this data we do so in two
    steps:
    
    1. Count the number of rows
    2. If this number is greater than 0, iterate over the rows
    
    By returning an Array instead we only execute 1 query of which the total
    time/work is less than running either just a COUNT(*) or both queries
    (in the worst case).
    
    On GitLab.com this change should save us a few milliseconds per request
    to ProjectsController#show.
    54f1e406
pipeline.rb 14.7 KB