From: Sarah Hoffmann Date: Fri, 24 Aug 2012 23:24:57 +0000 (+0200) Subject: reduce limits on high loads and order results correctly X-Git-Tag: deploy~678 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/982de35051bed16cb57739c7b4acabe4c7f251ac reduce limits on high loads and order results correctly --- diff --git a/utils/cron_banip.sh b/utils/cron_banip.sh index c73db560..2e0c8dfb 100755 --- a/utils/cron_banip.sh +++ b/utils/cron_banip.sh @@ -23,6 +23,11 @@ SRCHSHORT_LIMIT='10 min' PSQLCMD='psql -qtA -d nominatim' +curload=`cat /proc/loadavg | sed 's:[. ].*::'` +if [ "$curload" -gt "15" ]; then + REVSHORT_LIMIT=$((REVSHORT_LIMIT/2)) +fi + # Blocking candidates $PSQLCMD > $BLOCKEDFILE.newblocks << ENDOFQUERY SELECT ipaddress FROM @@ -70,10 +75,12 @@ if [ "x$blocked" == "x" ]; then mv $BLOCKEDFILE.newblocks $BLOCKEDFILE else $PSQLCMD > $BLOCKEDFILE.newlifted << ENDOFQUERY + SELECT column1 FROM ( VALUES ('$blocked') EXCEPT (SELECT DISTINCT ipaddress FROM new_query_log WHERE starttime > now() - interval '$COOLOFF_PERIOD') + ) as q ORDER BY column1; ENDOFQUERY no_lifted=`cat $BLOCKEDFILE.newlifted | wc -w`