From 8e8d9abe3b791880f0e1cb39409cf20eee7cf8e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Sun, 3 Jan 2016 18:24:46 +0200 Subject: [PATCH] Limit the number of inserted placeholders. Otherwise, if period=1m and grace=1m then we can end up generating huge useless tables. --- hc/front/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hc/front/views.py b/hc/front/views.py index c2bacc06..322868ee 100644 --- a/hc/front/views.py +++ b/hc/front/views.py @@ -215,9 +215,11 @@ def log(request, code): # Fill in "missed ping" placeholders: expected_date = older.created + check.timeout - while expected_date + check.grace < newer.created: + limit = 0 + while expected_date + check.grace < newer.created and limit < 10: wrapped.append({"placeholder_date": expected_date}) expected_date = expected_date + check.timeout + limit += 1 # Prepare early flag for next ping to come early = older.created + check.timeout > newer.created + check.grace