Skip to content

restart: :transient does not affect Task.Supervisor.async/async_nolink #4517

@sikanhe

Description

@sikanhe

For task supervisors, the processes can only be restarted when using start_child method. We cannot currently await on a task that we want to retry.

{:ok, tas} = Task.Supervisor.start_link(restart: :transient)

Task.Supervisor.async_nolink(tas, fn -> 1 = 2 end) 
// does not restart

I understand there is a limitation that a Task is tied to a process, so it cannot possibly know about the new process that could get started. But this was unclear in the documentation.

Do you think there is a way to await on a supervised task that be restarted on crash? If so we should implement it because there is many cases where this could be helpful. If not I think we should clarify this in the docs more.

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