X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/93b2bac094fa0b67f891cf293a43d3cd146b2ea5..03d6c48ef1bbc4ccd057125db6df015c0f8e53f0:/utils/cron_banip.sh 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`