pyscript icon indicating copy to clipboard operation
pyscript copied to clipboard

@task_unique decorator not equivalent to task.unique()

Open austinche opened this issue 3 months ago • 2 comments

With the @task_unique(name) decorator, the task name is set to ['<name>'] instead of name. task.unique(name) sets the name correctly which means that mixing the two behaves unexpectedly.

Test code:

@time_trigger
@task_unique('test1')
def test():
    task.unique('test2')
    log.warning(task.name2id())

and this is logged

{"['test1']": <Task pending name='Task-2691674' coro=<Function.run_coro() running at /config/custom_components/pyscript/function.py:448>>, 'test2': <Task pending name='Task-2691674' coro=<Function.run_coro() running at /config/custom_components/pyscript/function.py:448>>}

austinche avatar Sep 25 '25 23:09 austinche

@craigbarratt this one is for you

ALERTua avatar Sep 26 '25 06:09 ALERTua

Thanks for the bug report. I just pushed 515a5c2 which should fix it.

craigbarratt avatar Sep 28 '25 15:09 craigbarratt