From 5c59f59f9cbbf5bdde28e44fdbec60c4d9a3c39e Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 30 Nov 2016 01:21:13 +0000 Subject: [PATCH] Block a scale used by a scraper --- cookbooks/tile/templates/default/export.erb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cookbooks/tile/templates/default/export.erb b/cookbooks/tile/templates/default/export.erb index c05083835..b91c3957f 100644 --- a/cookbooks/tile/templates/default/export.erb +++ b/cookbooks/tile/templates/default/export.erb @@ -70,6 +70,9 @@ idletime = cputimes[3] / sum(cputimes) if idletime < 0.2: # Abort if the CPU idle time on the machine is too low output_error("The server is too busy at the moment. Please wait a few minutes before trying again.", "503 Service Unavailable") +elif form.getvalue("scale") == "4600": + # Block scraper + output_error("The server is too busy at the moment. Please wait a few minutes before trying again.", "503 Service Unavailable") <% @blocks["user_agents"].each do |user_agent| -%> elif os.environ['HTTP_USER_AGENT'] == '<%= user_agent %>': # Block scraper -- 2.39.5