diff --git a/snappea/decorators.py b/snappea/decorators.py index 477a7dc..809baa5 100644 --- a/snappea/decorators.py +++ b/snappea/decorators.py @@ -27,6 +27,7 @@ def shared_task(function): # No need for a transaction: we just write something (not connected to any other object, and we will never # touch it again). Counterpoint: if we'd have a transaction, we could distinguish between "wait for write # lock" and "actually write". + # observed timings: ~2.8ms, see also: https://www.bugsink.com/blog/snappea-design/#throughput kwargs.update(add_task_kwargs()) Task.objects.create(task_name=name, args=json.dumps(args), kwargs=json.dumps(kwargs)) diff --git a/snappea/foreman.py b/snappea/foreman.py index 237f55e..e2ea0d4 100644 --- a/snappea/foreman.py +++ b/snappea/foreman.py @@ -343,6 +343,7 @@ class Foreman: # (see 'counterpoint' in decorators.py for a counterpoint) # * delete-before-run is the implementation of our at-most-once guarantee with time_to_logger(performance_logger, "Snappea Task.delete()"): + # observed timings: ~1.5ms, see also: https://www.bugsink.com/blog/snappea-design/#throughput task.delete() self.run_in_thread(task_id, function, *args, **kwargs)