Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(service): fix cache not getting refreshed #3657

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions renku/ui/service/gateways/repository_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,17 @@ def get(
"""Get a project from cache (clone if necessary)."""
if git_url is None:
raise ValidationError("Invalid `git_url`, URL is empty", "git_url")
# Note: walrus turns None into empty strings
branch = branch or ""
commit_sha = commit_sha or ""

git_url = normalize_git_url(git_url)
try:
project = Project.get(
(Project.user_id == user.user_id) & (Project.git_url == git_url) & (Project.branch == branch)
(Project.user_id == user.user_id)
& (Project.git_url == git_url)
& (Project.branch == branch)
& (Project.commit_sha == commit_sha)
)
except ValueError:
# project not found in DB
Expand Down Expand Up @@ -225,7 +231,7 @@ def _maybe_update_cache(self, project: Project, user: User):
if project.fetch_age < PROJECT_FETCH_TIME:
return

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

Expand Down