• Stan Hu's avatar
    Fix CI instance variable cache misses · 0410fb86
    Stan Hu authored
    Previously the CI variable instance cache always attempted to read
    Redis for a timestamp to determine whether the value was
    up-to-date. The problem was that in a system with multiple processes
    reading from the cache, the timestamp would constantly be advancing,
    making it appear as though the cache always were stale. Not only did
    this incur one Redis call per lookup, but also this would result in
    frequent cache misses.
    
    Since we mostly just use this cache data set in the creation of
    pipelines, we can likely live with a 30-second delay between the time
    when the variable is set and when it is live.
    
    For the `gitlab-org/gitlab` project, this should reduce the overall
    pipeline creation time by around 1.5 seconds (11% of the time), not to
    mention reduce the network and memory overhead.
    
    Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/322386
    
    Changelog: fixed
    0410fb86
instance_variable.rb 1.33 KB