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

Every time a new async task when want to create tickets over API, when creation is not finished #3758

Open
gerhard1712 opened this issue Dec 2, 2023 · 1 comment

Comments

@gerhard1712
Copy link

gerhard1712 commented Dec 2, 2023

Problem and impact

When call the "GET /api/v1/organizers/(organizer)/events/(event)/orders/(code)/download/pdf/"-function and the file does not yet exist, a RetryException will caused. And a new async task is created.
In Code src/pretix/api/views/order.py in the download function (line 346)

        ct = CachedCombinedTicket.objects.filter(
            order=order, provider=provider.identifier, file__isnull=False
        ).last()
        if not ct or not ct.file:
            generate.apply_async(args=('order', order.pk, provider.identifier))
            raise RetryException()

When i call every second this api call, a new async task will be created when the file not exist.
This result to 100% cpu usage for pretix worker, because multiple task exists for the same order_id
Is this a bug or intended behavior?

Expected behaviour

No response

Steps to reproduce

1, Take a order with many different products
2, Mark order as paid or set valid_if_pending to true
3, Call the "GET /api/v1/organizers/(organizer)/events/(event)/orders/(code)/download/pdf/"-function every second when 409 occour

Screenshots

No response

Link

No response

Browser (software, desktop or mobile?) and version

No response

Operating system, dependency versions

No response

Version

2023.10.0

@wiffbi
Copy link
Contributor

wiffbi commented Dec 4, 2023

Thanks for reporting, we will look into this.

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