events: don't prefill task if they already have a state
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
a1b3af401d
commit
2c06eed8e7
|
@ -81,7 +81,7 @@ class TaskInfo:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def by_name(name: str) -> Optional["TaskInfo"]:
|
def by_name(name: str) -> Optional["TaskInfo"]:
|
||||||
"""Get TaskInfo Object by name"""
|
"""Get TaskInfo Object by name"""
|
||||||
return cache.get(f"task_{name}")
|
return cache.get(f"task_{name}", None)
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
"""Delete task info from cache"""
|
"""Delete task info from cache"""
|
||||||
|
@ -116,6 +116,9 @@ def prefill_task():
|
||||||
"""Ensure a task's details are always in cache, so it can always be triggered via API"""
|
"""Ensure a task's details are always in cache, so it can always be triggered via API"""
|
||||||
|
|
||||||
def inner_wrap(func):
|
def inner_wrap(func):
|
||||||
|
status = TaskInfo.by_name(func.__name__)
|
||||||
|
if status:
|
||||||
|
return func
|
||||||
TaskInfo(
|
TaskInfo(
|
||||||
task_name=func.__name__,
|
task_name=func.__name__,
|
||||||
task_description=func.__doc__,
|
task_description=func.__doc__,
|
||||||
|
|
Reference in New Issue