mirror of
https://github.com/jlengrand/bugsink.git
synced 2026-03-10 08:01:17 +00:00
Document timing of task.create/delete in code
This commit is contained in:
@@ -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
|
# 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
|
# touch it again). Counterpoint: if we'd have a transaction, we could distinguish between "wait for write
|
||||||
# lock" and "actually write".
|
# lock" and "actually write".
|
||||||
|
# observed timings: ~2.8ms, see also: https://www.bugsink.com/blog/snappea-design/#throughput
|
||||||
kwargs.update(add_task_kwargs())
|
kwargs.update(add_task_kwargs())
|
||||||
Task.objects.create(task_name=name, args=json.dumps(args), kwargs=json.dumps(kwargs))
|
Task.objects.create(task_name=name, args=json.dumps(args), kwargs=json.dumps(kwargs))
|
||||||
|
|
||||||
|
|||||||
@@ -343,6 +343,7 @@ class Foreman:
|
|||||||
# (see 'counterpoint' in decorators.py for a counterpoint)
|
# (see 'counterpoint' in decorators.py for a counterpoint)
|
||||||
# * delete-before-run is the implementation of our at-most-once guarantee
|
# * delete-before-run is the implementation of our at-most-once guarantee
|
||||||
with time_to_logger(performance_logger, "Snappea Task.delete()"):
|
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()
|
task.delete()
|
||||||
|
|
||||||
self.run_in_thread(task_id, function, *args, **kwargs)
|
self.run_in_thread(task_id, function, *args, **kwargs)
|
||||||
|
|||||||
Reference in New Issue
Block a user