Skip to content

@task_unique decorator not equivalent to task.unique() #761

@austinche

Description

@austinche

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>>}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions