Skip to content

Issue with concurrent Patch requests #646

@ekos2001

Description

@ekos2001

Hello,
We have some problems with the Patch implementation provided by the library when adding members to a group.
We have an Azure with 1000 or more members and during initial sync for every member, Azure sends separate Patch request. And these requests are concurrent, in my tests, I'm getting up to 5 requests at a time.

Our logic of the Update method in the GroupHandler is similar to what you have here

In some cases, it may happen that in the GroupHandler#Update method, the data in the database is changed by another thread (or another server instance) and after comparison, we delete the member that was just added in the concurrent thread. See the attached diagram, it may help you better understand the problem.

Do you have any recommendations on how to resolve this?

We were thinking that one of the options could be to synchronize all Patch calls for the same group, but in case of multiple servers it can be not that easy to implement.
Another option would be to pass the original group to the GroupHandler#Update (or another new handler method) together with the patched object, so we can compare it to know the diff without reading the data from the DB a second time in the GroupHandler#Update.

Thank you

image
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions