• Stan Hu's avatar
    Memoize Repository#empty? instead of double caching the value · 611929eb
    Stan Hu authored
    We saw that in a customer instance, `empty?` was cached to be `true` even
    though `has_visible_content?` and `exists?` were `true`. This double caching
    can run into edge cases because there's no guarantee that the inner values
    will properly expire the outer one, especially if there is Redis replication lag.
    Consider this scenario:
    
    1. `exists?` and `has_visible_content?` are false
    2. `empty?` is expired
    3. A subsequent call to `empty?` returns `true` because `exists?` is false even though `empty` is true
    4. `exists?` and `has_visible_content?` are then expired
    5. `exists?` and `has_visible_content?` are set to true
    6. `empty?` is still stuck in the wrong value as `true`
    
    Closes #43882
    611929eb
sh-remove-double-caching-repo-empty.yml 89 Bytes