[tor-commits] [ooni-probe/master] Add note about locking logic for run() of tasks

art at torproject.org art at torproject.org
Mon Sep 19 12:14:25 UTC 2016


commit 6d13ade8bf4faae42e18c4e2c79dc695891d75c4
Author: Arturo Filastò <arturo at filasto.net>
Date:   Thu Sep 15 19:39:17 2016 +0200

    Add note about locking logic for run() of tasks
---
 ooni/agent/scheduler.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/ooni/agent/scheduler.py b/ooni/agent/scheduler.py
index c86e3b6..e8fef53 100644
--- a/ooni/agent/scheduler.py
+++ b/ooni/agent/scheduler.py
@@ -398,6 +398,15 @@ class SchedulerService(service.MultiService):
         """
         This function is called every self.interval seconds to check
         which periodic tasks should be run.
+
+        Note: the task will wait on the lock if there is already a task of
+        that type running. This means that if a task is very long running
+        there can potentially be a pretty large backlog of accumulated
+        periodic tasks waiting to know if they should run.
+        XXX
+        We may want to do something like not wait on the lock if there is
+        already a queue that is larger than a certain amount or something
+        smarter if still starts to become a memory usage concern.
         """
         for task in self._scheduled_tasks:
             log.debug("Running task {0}".format(task.identifier))





More information about the tor-commits mailing list