Skip to content

Commit

Permalink
Merge pull request #487 from shadowmere-xyz/improve-ports-query
Browse files Browse the repository at this point in the history
Move all filtering on the ports endpoint to the query
  • Loading branch information
jadolg authored Sep 22, 2024
2 parents d3b34de + 4677bca commit 86c176b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions proxylist/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,13 @@ class PortViewSet(viewsets.ViewSet):

@method_decorator(cache_page(20 * 60))
def list(self, request, format=None):
ports = [
port
for port in Proxy.objects.filter(is_active=True)
ports = (
Proxy.objects.filter(is_active=True, port__gt=0)
.values_list("port", flat=True)
.distinct()
if port != 0
]
ports.sort()
.order_by("port")
)

ports = [
{
"port": port,
Expand Down

0 comments on commit 86c176b

Please sign in to comment.