-
-
Notifications
You must be signed in to change notification settings - Fork 311
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
[14.0][IMP] product_import: Import products asynchronously #1076
base: 14.0
Are you sure you want to change the base?
Conversation
96ad6db
to
4f485a1
Compare
4f485a1
to
2a26180
Compare
9bed83c
to
967c912
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
a6f4537
to
c246786
Compare
c246786
to
1df34b7
Compare
@@ -13,9 +13,12 @@ | |||
"stock", | |||
# OCA/edi | |||
"base_business_document_import", | |||
# OCA/queue | |||
"queue_job", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've thought again about this... We should remove this dependency IMO.
In the simplest case we won't need it, in the more complex case we'll probably use the framework. Then, we can leverage the framework to the split.
Additionally, there's now a new feature in queue_job which is called split
and allows to.... split items in batches.
See OCA/queue#658
if products[-1] is None: | ||
products = [product for product in products if product] | ||
# One job for x products (chunk of 40) | ||
wiz.with_delay()._create_update_products(products, seller.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here I would simply call wiz.create_update_products
that will call _create_update_products
which can be overridden or you can rely on https://github.com/OCA/queue/blob/16.0/queue_job/models/base.py#L145
Some catalogs contain 10'000 references and import does not complete due to other tasks running at the same time, and locking table.
Splitting product import into individual jobs should mitigate this issue.