Skip to content

[18.0][FEAT] replace threading by queue job #1096

Open
wouitmil wants to merge 86 commits intoOCA:18.0from
camptocamp:18-jobs-instead-of-threads
Open

[18.0][FEAT] replace threading by queue job #1096
wouitmil wants to merge 86 commits intoOCA:18.0from
camptocamp:18-jobs-instead-of-threads

Conversation

@wouitmil
Copy link

@wouitmil wouitmil commented Dec 22, 2025

@wouitmil wouitmil force-pushed the 18-jobs-instead-of-threads branch from acb390a to 7e91022 Compare December 22, 2025 19:01
@grindtildeath
Copy link
Contributor

You should mention in description this is based on

IMO we should push to have these other PRs merged before taking care of this one

@wouitmil wouitmil force-pushed the 18-jobs-instead-of-threads branch 2 times, most recently from 93cbb96 to 5dd1501 Compare December 23, 2025 00:02
@wouitmil
Copy link
Author

You should mention in description this is based on

IMO we should push to have these other PRs merged before taking care of this one

the pr: add advisory lock by batch for generation #1075 will be closed as soon as this one is merged as it's not necessary anymore. I'll then remove the related commits from this PR

@wouitmil wouitmil force-pushed the 18-jobs-instead-of-threads branch from 5dd1501 to 910880a Compare December 23, 2025 00:29
@wouitmil wouitmil force-pushed the 18-jobs-instead-of-threads branch from b87e0ad to e52af15 Compare December 29, 2025 15:00
@Ricardoalso Ricardoalso force-pushed the 18-jobs-instead-of-threads branch from 8ebb0f5 to c9db64f Compare January 12, 2026 10:18
@wouitmil wouitmil force-pushed the 18-jobs-instead-of-threads branch from 777f94d to 116a423 Compare January 20, 2026 15:34
imlopes and others added 20 commits January 20, 2026 21:35
- change name to batch to match with change of `picking_dispatch` name to
`stock_batch_picking`
- mode description in README.rst
- move files in models and views directories
- change headers to small license header
- use api 8.0
- fix and improve tests
the field has been renamed in the base module
Probably due to usage of multiple environment and cache. datas can't be
read from shipping.label but it can be read from ir.attachment
When there is more than 1 pack in a picking, 2 or more thread worker
might be in concurrence on the same picking, which makes one of the
transaction fails, resulting in the abort of the whole label generation.

The solution implemented is to change the way of passing the tasks to
the thread workers. Instead of passing a label at a time, we pass a
group of label. A group of label actually contains all the labels to
generate for one picking.
Camille0907 and others added 20 commits January 20, 2026 21:35
… by ``UserError.args[0]``

In the label generation, when getting an error, we were using its ``name``, however, this is deprecated since a while and as been removed in odoo/odoo@d200dcf.
We should use ``args[0]`` instead.
… return ``stock.move.line`` records instead of an Iterator

All calls to this method expect ``stock.move.line`` records.
Regenerating the carrier labels would crash with a Concurent Update
error.

We use a new cursor for tracking reference purge and avoid concurrent update
when the labels regeneration also updates that field in a separate
cursor afterwards: this ensures that the purge is committed before the
transactions created by the threads also update and commit their own
changes.
Don't spawn more threads than needed: if there are fewer groups to
process than the configured max number of threads, only start the
specified number of threads.
@wouitmil wouitmil force-pushed the 18-jobs-instead-of-threads branch from 2674610 to 210637c Compare January 20, 2026 20:39
@wouitmil wouitmil force-pushed the 18-jobs-instead-of-threads branch from 210637c to 086e466 Compare January 20, 2026 20:55
@wouitmil wouitmil force-pushed the 18-jobs-instead-of-threads branch from afe9e6e to 609eb5b Compare February 24, 2026 11:59
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

Successfully merging this pull request may close these issues.