Work with the multiuser environment

This is my first app development that will be used by 10-15 people in agreement. I'm not quite sure of a good way to minimize update collisions.

In fact, my application works as follows. New items are inserted into the database through an external service as they are received. Business rules indicate that each element should be reviewed by two independent employees. Needless to say, there is a one-to-many relationship between the subject and the reviews. What is the most important aspect of the application is that no single item can exceed two reviews, and the system should keep track of who the two reviewers were. In addition, who acted as the first reviewer and the second.

Now everything works for me. The problem I'm dealing with is (one of many similar scenarios). What happens if all users update their product list in the same 5 minutes from each other. User 1 submits a review for the identifier of item 1. A second person submits a review for the same item. Now a third party submits a review for the element id 1, but there are already 2 reviews, therefore the element is marked as completed.

What are the possible ways to work with a multi-user environment where there is a high probability that several users will update the same record?

+6
source share
2 answers

I don’t know the details of your application, but it seems that the review process broadens the window in which several people can start viewing, and then when they complete it, more than two end,

One option is to introduce the concept of starting a review. When someone initiates a validation action, they β€œbegin” the review. This marks how it started. The system must not allow more than two starts.

You can also make it more advanced by choosing a time that we never β€œsent” or were unable to delete the pending review that was running.

+7
source

Nhibernate has various concurreny models that you implement in your project based on your needs.

Take a look at NHibernate- Concurrency

+5
source

Source: https://habr.com/ru/post/897790/


All Articles