Skip to content

internal/extsvc/github: Simplify cachedGetRepository and its usage

Administrator requested to merge ig/simplify-cachedGetRepository into main

Created by: indradhanush

I was pairing with @mollylogue last week which is when the nocache falg tripped us up a little.

👉 Note to reviewers: The diff might be easier to check out with whitespaces disabled: https://github.com/sourcegraph/sourcegraph/pull/28725/files?diff=unified&w=1

As the name suggests, the method checks the cache before making an API request. As a result it shouldn't really be accepting another flag (nocache) to circumvent that process. A consumer can directly use getRepositoryFromAPI if that was the requirement.

Additionally, the only place this method is used at the moment is in the GitHub V3Client.GetRepository and the value of nocache is set to false. As a result this is unreachable code and removing the argument from the method's signature is a safe change.

Link to Sourcegraph query is here.

Finally, in this commit we also remove the inline closure from the invocation of cachedGetRepository and make it explicit to improve readability.

Merge request reports

Loading