From 81c8b7d3e239efd8a2e92c2dec529b2a15997f51 Mon Sep 17 00:00:00 2001 From: Adnan Maolood Date: Sun, 13 Feb 2022 12:00:10 -0500 Subject: [PATCH] gitsrht: Remove references to autocreated The autocreated visibility isn't used anymore. --- gitsrht-periodic | 20 -------------------- gitsrht/blueprints/api/info.py | 3 +-- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/gitsrht-periodic b/gitsrht-periodic index 27b4ba6..8f153f0 100755 --- a/gitsrht-periodic +++ b/gitsrht-periodic @@ -25,25 +25,6 @@ tg = Gauge("gitsrht_periodic_time", ["section"], registry=registry) -cleanup_autocreated_t = tg.labels("cleanup_autocreated") -@cleanup_autocreated_t.time() -def cleanup_autocreated(): - rc = Gauge("gitsrht_periodic_cleanup_autocreated_count", - "Amount of repos cleaned by the cleanup_autocreated job", - registry=registry) - - due = datetime.utcnow() - timedelta(minutes=20) - repos = (Repository.query - .filter(Repository.visibility == RepoVisibility.autocreated) - .filter(Repository.created < due)).all() - for r in repos: - # Use session.delete()+do_delete_repo() instead of d_r(), - # which commits immediately - repo_api.do_delete_repo(r) - db.session.delete(r) - rc.inc() - db.session.commit() - gc_git_t = tg.labels("gc_git") @gc_git_t.time() def gc_git(): @@ -123,7 +104,6 @@ def gc_s3(): all_t = tg.labels("total") @all_t.time() def all(): - cleanup_autocreated() gc_git() gc_s3() all() diff --git a/gitsrht/blueprints/api/info.py b/gitsrht/blueprints/api/info.py index 3c662e7..442acfa 100644 --- a/gitsrht/blueprints/api/info.py +++ b/gitsrht/blueprints/api/info.py @@ -19,8 +19,7 @@ info = Blueprint("api_info", __name__) def repos_by_user_GET(username): user = get_user(username) repos = (Repository.query - .filter(Repository.owner_id == user.id) - .filter(Repository.visibility != RepoVisibility.autocreated)) + .filter(Repository.owner_id == user.id)) if user.id != current_token.user_id: repos = (repos .outerjoin(Access._get_current_object(), -- 2.38.4