Skip to content

Deal with increment parallelism #10081

@l-you

Description

@l-you

Suppose we have e-commerce website with hot sales. There often can be a case where product stock is decremented in parallel requests.
Solution can be to use mysql directly UPDATE product SET stock=stock-1.
But it has drawbacks. For example task is "Create order and reduce stock". I reduce stock with direct mysql query, but during
->flush() exception appears and order not saved. So I have reduced stock and no order.
Is there a way UPDATE product SET stock=stock-1 to be persisted, so it will execute with other updates when ->flush() is called?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions