-
Notifications
You must be signed in to change notification settings - Fork 9
WC2-852: Fix imports fails due to storage logs #2562
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
base: develop
Are you sure you want to change the base?
Conversation
`process_mobile_bulk_upload` was wrapped into one giant transaction. This was problematic because we can have multiple zips each with the **full** storage logs. The storage logs could point on entities that are created in one of the zips. If we have entities created in at least two zips, the storage logs can never succeed and therefore the import of all the zips is blocked. Also, I extracted the logic of finding an entity to attach the storage logs to the proper entity even when there are duplicates. WC2-852
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 couldn't test that because I don't have the required setup, but LGTM 👍
Nitpick: I would add a unit test to show that import_storage_logs doesn't raise an exception anymore when an entity is missing
I'll let the others who are more familiar with entities and storage logs approve.
| if entity_type_id is not None: | ||
| filters = { | ||
| "uuid": entity_uuid, | ||
| "entity_type_id": entity_type_id, | ||
| "account": account, | ||
| } | ||
| else: | ||
| filters = { | ||
| "uuid": entity_uuid, | ||
| "account": account, | ||
| } |
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.
| if entity_type_id is not None: | |
| filters = { | |
| "uuid": entity_uuid, | |
| "entity_type_id": entity_type_id, | |
| "account": account, | |
| } | |
| else: | |
| filters = { | |
| "uuid": entity_uuid, | |
| "account": account, | |
| } | |
| filters = { | |
| "uuid": entity_uuid, | |
| "account": account, | |
| } | |
| if entity_type_id is not None: | |
| filters["entity_type_id"] = entity_type_id | |
process_mobile_bulk_uploadwas wrapped into one giant transaction. This was problematic because we can have multiple zips each with the full storage logs. The storage logs could point on entities that are created in one of the zips. If we have entities created in at least two zips, the storage logs can never succeed and therefore the import of all the zips is blocked.Also, I extracted the logic of finding an entity to attach the storage logs to the proper entity even when there are duplicates.
Related JIRA tickets : WC2-852
Self proofreading checklist
Changes
See top of the PR
How to test
It's quite hard to test because you need to send two zips with some entities created in each zips and have storage logs to point to those new entities.
The best is to test that synchronizing using zip is still working fine.
Follow the Conventional Commits specification
The merge message of a pull request must follow the Conventional Commits specification.
This convention helps to automatically generate release notes.
Use lowercase for consistency.
Example:
Note that the Jira reference is preceded by a line break.
Both the line break and the Jira reference are entered in the Add an optional extended description… field.