Skip to content

Commit

Permalink
Tile limit
Browse files Browse the repository at this point in the history
  • Loading branch information
keller-mark committed May 29, 2020
1 parent 2dd1a96 commit b5718ae
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tilesets/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,8 @@ def tiles(request):
tileids_to_fetch = set()
tileset_to_options = dict()

TILE_LIMIT = 1000

if request.method == 'POST':
# This is a POST request, so try to parse the request body as JSON.
try:
Expand Down Expand Up @@ -433,6 +435,11 @@ def tiles(request):
# create a set so that we don't fetch the same tile multiple times
tileids_to_fetch = set(request.GET.getlist("d"))

if len(tileids_to_fetch) > TILE_LIMIT:
return JsonResponse({
'error': "Too many tiles were requested.",
}, status=rfs.HTTP_400_BAD_REQUEST)

# with ProcessPoolExecutor() as executor:
# res = executor.map(parallelize, hargs)
'''
Expand Down

0 comments on commit b5718ae

Please sign in to comment.