fix: don't update cache for empty state

This commit is contained in:
Michael Kriese 2024-04-16 12:02:01 +02:00
parent c0d22d55c9
commit 8e9c296014
No known key found for this signature in database
GPG key ID: F8D7748549A5986A

View file

@ -187,7 +187,7 @@ func FindReposLastestCommitStatuses(ctx context.Context, repos []*repo_model.Rep
for i, repo := range repos {
if results[i] == nil {
results[i] = git_model.CalcCommitStatus(repoToItsLatestCommitStatuses[repo.ID])
if results[i] != nil {
if results[i] != nil && results[i].State != "" {
if err := updateCommitStatusCache(repo.ID, repo.DefaultBranch, results[i].State, results[i].TargetURL); err != nil {
log.Error("updateCommitStatusCache[%d:%s] failed: %v", repo.ID, repo.DefaultBranch, err)
}