Skip to content

Commit 130c21d

Browse files
authored
fix(service): fix cache not getting refreshed (#3657)
1 parent c1be009 commit 130c21d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

renku/ui/service/gateways/repository_cache.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,17 @@ def get(
5656
"""Get a project from cache (clone if necessary)."""
5757
if git_url is None:
5858
raise ValidationError("Invalid `git_url`, URL is empty", "git_url")
59+
# Note: walrus turns None into empty strings
60+
branch = branch or ""
61+
commit_sha = commit_sha or ""
5962

6063
git_url = normalize_git_url(git_url)
6164
try:
6265
project = Project.get(
63-
(Project.user_id == user.user_id) & (Project.git_url == git_url) & (Project.branch == branch)
66+
(Project.user_id == user.user_id)
67+
& (Project.git_url == git_url)
68+
& (Project.branch == branch)
69+
& (Project.commit_sha == commit_sha)
6470
)
6571
except ValueError:
6672
# project not found in DB
@@ -225,7 +231,7 @@ def _maybe_update_cache(self, project: Project, user: User):
225231
if project.fetch_age < PROJECT_FETCH_TIME:
226232
return
227233

228-
if project.commit_sha is not None:
234+
if project.commit_sha is not None and project.commit_sha != "":
229235
# NOTE: A project in a detached head state at a specific commit SHA cannot be updated
230236
return
231237

0 commit comments

Comments
 (0)