From: Sarah Hoffmann Date: Wed, 3 Apr 2013 21:10:53 +0000 (+0200) Subject: upper bound on bulks X-Git-Tag: deploy~627 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/cb3a8db02575d3ba4ca24e45a83b4d8dc4edb0c9?hp=ca11fc90e6e646335045e087f03d824236c798f2 upper bound on bulks --- diff --git a/utils/cron_banip.py b/utils/cron_banip.py index 55a7b295..4fe30640 100755 --- a/utils/cron_banip.py +++ b/utils/cron_banip.py @@ -106,8 +106,10 @@ cur = conn.cursor() cur.execute("select count(*)/60 from new_query_log where starttime > now() - interval '1min'") dbload = int(cur.fetchone()[0]) -BLOCK_LIMIT = max(BLOCK_LOWER, BLOCK_UPPER - BLOCK_LOADFAC * (dbload - 70)) +BLOCK_LIMIT = max(BLOCK_LOWER, BLOCK_UPPER - BLOCK_LOADFAC * (dbload - 75)) BULKLONG_LIMIT = max(BULK_LOWER, BULKLONG_LIMIT - BULK_LOADFAC * (avgload - 14)) +if len(prevbulks) > 85: + BLOCK_LIMIT = BLOCK_LOWER # get the new block candidates cur.execute(""" @@ -117,7 +119,7 @@ cur.execute(""" WHERE starttime > now() - interval '1 hour' GROUP BY ipaddress) as i WHERE count > %s) UNION - (SELECT ipaddress, count * 4 FROM + (SELECT ipaddress, count * 3 FROM (SELECT ipaddress, sum(case when endtime is null then 1 else 1+date_part('epoch',endtime-starttime) end) as count FROM new_query_log WHERE starttime > now() - interval '10 min' GROUP BY ipaddress) as i WHERE count > %s)) as o