RepositorySetCache doesn't cache empty sets
In #36154 (comment 252765396), I observed that my CI runner was always invoking a duplicate FindAllTagNames RPCs because the list of tags in the repo was empty (https://gitlab.com/gitlab-org/gitlab/blob/396f92d05eed50fae48b4d50c4b97bc1607298d2/lib/gitlab/repository_set_cache.rb#L40). Redis doesn't have a way to distinguish empty vs non-existent sets:
- https://github.com/antirez/redis/issues/6048
- https://www.bennadel.com/blog/2965-redis-doesn-t-store-empty-sets-or-hashes-and-will-delete-empty-sets-and-hashes.htm
I'm not sure how big of a deal is this. I could see a case where a large repo may have many branches or no tags (or vice versa) where performing a duplicate request may slow things down significantly.
Couple ways we can deal with this:
- Add a blank or some invalid name to the set that gets filtered out.
- Use a different key to determine whether the set exists.
/cc: @nick.thomas