queue icon indicating copy to clipboard operation
queue copied to clipboard

Problem with perform_enqueued_jobs function

Open SonoDavid opened this issue 10 months ago • 2 comments

For me, the following function doesn't work as it should for queue jobs using graphs. Somehow, all of the jobs get assigned the same graph_uuid and this is why the function below does not do the sorting correctly. Also, priority field is not included in the sorting, which would also help to get the jobs sorting in the correct order.

    def perform_enqueued_jobs(self):
        """Perform the enqueued jobs synchronously"""

        def by_graph(job):
            return job.graph_uuid or ""

        sorted_jobs = sorted(self.enqueued_jobs, key=by_graph)
        self.enqueued_jobs = []
        for graph_uuid, jobs in groupby(sorted_jobs, key=by_graph):
            if graph_uuid:
                self._perform_graph_jobs(jobs)
            else:
                self._perform_single_jobs(jobs)

Can somebody explain to me where and how the graph_uuid gets assigned and why this does work for my live environment, but not in the tests?

SonoDavid avatar Jan 21 '25 12:01 SonoDavid

Odoo Version? Are you using the latest version?

simahawk avatar Mar 03 '25 07:03 simahawk

Odoo version 17.0, version: around 9 february 2025.

SonoDavid avatar Mar 03 '25 08:03 SonoDavid

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

github-actions[bot] avatar Aug 31 '25 12:08 github-actions[bot]