Remove unusable sitemap endpoint
It calls a data model method which is extremely slow and heavy, and it isn't even used anyway
This commit is contained in:
parent
9e2c5417b8
commit
9190c046c7
4 changed files with 0 additions and 29 deletions
|
@ -655,17 +655,6 @@ def confirm_email_authorization_for_repo(code):
|
||||||
return found
|
return found
|
||||||
|
|
||||||
|
|
||||||
def list_popular_public_repos(action_count_threshold, time_span, repo_kind='image'):
|
|
||||||
cutoff = datetime.now() - time_span
|
|
||||||
return (Repository.select(Namespace.username, Repository.name)
|
|
||||||
.join(Namespace, on=(Repository.namespace_user == Namespace.id)).switch(Repository)
|
|
||||||
.join(RepositoryActionCount).where(RepositoryActionCount.date >= cutoff,
|
|
||||||
Repository.visibility == get_public_repo_visibility(),
|
|
||||||
Repository.kind == Repository.kind.get_id(repo_kind))
|
|
||||||
.group_by(RepositoryActionCount.repository, Repository.name, Namespace.username)
|
|
||||||
.having(fn.Sum(RepositoryActionCount.count) >= action_count_threshold).tuples())
|
|
||||||
|
|
||||||
|
|
||||||
def is_empty(namespace_name, repository_name):
|
def is_empty(namespace_name, repository_name):
|
||||||
""" Returns if the repository referenced by the given namespace and name is empty. If the repo
|
""" Returns if the repository referenced by the given namespace and name is empty. If the repo
|
||||||
doesn't exist, returns True.
|
doesn't exist, returns True.
|
||||||
|
|
|
@ -46,9 +46,3 @@ def test_search_pagination(query, authed_username, initialized_db):
|
||||||
next_repos = get_filtered_matching_repositories(query, filter_username=authed_username, offset=1)
|
next_repos = get_filtered_matching_repositories(query, filter_username=authed_username, offset=1)
|
||||||
assert repositories[0].id != next_repos[0].id
|
assert repositories[0].id != next_repos[0].id
|
||||||
assert repositories[1].id == next_repos[0].id
|
assert repositories[1].id == next_repos[0].id
|
||||||
|
|
||||||
|
|
||||||
def test_popular_repo_list(initialized_db):
|
|
||||||
onlypublic = model.repository.list_popular_public_repos(0, timedelta(weeks=1))
|
|
||||||
assert len(onlypublic) == 1
|
|
||||||
assert onlypublic[0] == ('public', 'publicrepo')
|
|
||||||
|
|
|
@ -332,15 +332,6 @@ def robots():
|
||||||
return robots_txt
|
return robots_txt
|
||||||
|
|
||||||
|
|
||||||
@web.route('/sitemap.xml', methods=['GET'])
|
|
||||||
def sitemap():
|
|
||||||
popular_repo_tuples = model.repository.list_popular_public_repos(50, timedelta(weeks=1))
|
|
||||||
xml = make_response(render_template('sitemap.xml', public_repos=popular_repo_tuples,
|
|
||||||
baseurl=get_app_url()))
|
|
||||||
xml.headers['Content-Type'] = 'application/xml'
|
|
||||||
return xml
|
|
||||||
|
|
||||||
|
|
||||||
@web.route('/buildlogs/<build_uuid>', methods=['GET'])
|
@web.route('/buildlogs/<build_uuid>', methods=['GET'])
|
||||||
@route_show_if(features.BUILD_SUPPORT)
|
@route_show_if(features.BUILD_SUPPORT)
|
||||||
@process_auth_or_cookie
|
@process_auth_or_cookie
|
||||||
|
|
|
@ -228,9 +228,6 @@ class WebEndpointTestCase(EndpointTestCase):
|
||||||
def test_robots(self):
|
def test_robots(self):
|
||||||
self.getResponse('web.robots')
|
self.getResponse('web.robots')
|
||||||
|
|
||||||
def test_sitemap(self):
|
|
||||||
self.getResponse('web.sitemap')
|
|
||||||
|
|
||||||
def test_repo_view(self):
|
def test_repo_view(self):
|
||||||
self.getResponse('web.repository', path='devtable/simple')
|
self.getResponse('web.repository', path='devtable/simple')
|
||||||
|
|
||||||
|
|
Reference in a new issue