Skip to content

tasks killed via task.unique do not call done_callbacks #143

Closed
@dlashua

Description

@dlashua
@time_trigger('startup')
def startup_delayed():
    log.info('starting')
    task.sleep(2)
    my_task = task.create(do_stuff, 5)
    task.add_done_callback(my_task, all_done, 'delayed')

@time_trigger('startup')
def startup_normal():
    log.info('starting')
    my_task = task.create(do_stuff, 5)
    task.add_done_callback(my_task, all_done, 'normal')

def do_stuff(secs):
    task.unique('testing123')
    log.info(f'sleeping {secs}')
    task.sleep(secs)
    log.info(f'done sleeping {secs}')

def all_done(name):
    log.info(f'task has ended {name}')

In the above code, all_done is never called for normal since the task.unique from the delayed process kills that task.

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