From 5c76febaa458df58522f893e7ef245481882e666 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Sun, 16 May 2021 11:52:39 -0400 Subject: [PATCH] Fix memory leak --- app/flood.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/flood.py b/app/flood.py index 377d85e..31ee416 100644 --- a/app/flood.py +++ b/app/flood.py @@ -28,8 +28,9 @@ def setup(violations_threshold = 100): def report(request_ip): - banned[request_ip] = banned.get(request_ip, 0) - banned[request_ip] += 1 + if active: + banned[request_ip] = banned.get(request_ip, 0) + banned[request_ip] += 1 def is_banned(request_ip): # More than X offences?