Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unique schedule tasks? #319

Open
jedie opened this issue Sep 6, 2018 · 1 comment
Open

unique schedule tasks? #319

jedie opened this issue Sep 6, 2018 · 1 comment

Comments

@jedie
Copy link

jedie commented Sep 6, 2018

I'm wondering: It doesn't seem to be not easy to create unique schedule tasks...

It seems there is no out-of-the-box way for a create or update schedule task

django_q.tasks.schedule contains this:

    # check for name duplicates instead of am unique constraint
    if name and Schedule.objects.filter(name=name).exists():
        raise IntegrityError("A schedule with the same name already exists.")

Firstly: Why is django_q.models.Schedule.name not set as unique?

So basically I have to do a work-a-round like:

        Schedule.objects.filter(name="foobar").delete()
        schedule(
            func="foo.bar",
            name="foobar",
        )

Did I miss anything?

EDIT: It's related to #150 or?

@tboulogne
Copy link

@jedie

Hello, task_name is unique. So if you create your task with a task_name you will avoid this.
(i i understand your point)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants