~edwargix/git.sr.ht

81c8b7d3e239efd8a2e92c2dec529b2a15997f51 — Adnan Maolood 2 years ago 54933b0
gitsrht: Remove references to autocreated

The autocreated visibility isn't used anymore.
2 files changed, 1 insertions(+), 22 deletions(-)

M gitsrht-periodic
M gitsrht/blueprints/api/info.py
M gitsrht-periodic => gitsrht-periodic +0 -20
@@ 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()

M gitsrht/blueprints/api/info.py => gitsrht/blueprints/api/info.py +1 -2
@@ 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(),