From 2657e4a1390b04baeebce5554eb4c47f2684d6ca Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Sun, 7 Jul 2019 17:50:28 +0200 Subject: [PATCH] Tweak remote question fetching --- tasks.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tasks.py b/tasks.py index 34e4bb2..c2020b2 100644 --- a/tasks.py +++ b/tasks.py @@ -64,6 +64,8 @@ class Tasks: dt = parser.parse(question.closed or question.endTime).astimezone(timezone.utc) minutes = int((dt - now).total_seconds() / 60) - p.push( - question.id, "/task/fetch_remote_question", delay=minutes - ) # XXX: delay expects minutes + if minutes > 0: + # Only push the task if the poll is not ended yet + p.push( + question.id, "/task/fetch_remote_question", delay=minutes + ) # XXX: delay expects minutes