Question

This is my first time developing an application that will be used by 10-15 people concurentlyso I'm not exactly sure of a good way to minimize update collisions.

Essentially, my application works as follows. New items get inserted into the database via an external service as they get received. Business rules indicate that each item is to be reviewed by two independant employees. Needless to say, there is a one-to-many relationship between the item and reviews. What is the most important aspect of the application is that no item can exceed two reviews and the system must keep track of who were the two reviewers. Also, who acted as the first reviewer and second.

Now, I have everything working. The issue I'm dealing with is this (one of many simmilar scenarios). What happens if all users refreshed their item listing within the same 5 minutes of eachother. User 1 submits a review for item id 1. A second person submits a review on the same item. Now a third person submits a review on item id 1 but there are already 2 reviews so the item has been marked as complete.

What are possible ways to deal with a multi-user environment where there is a great possibility of several users updating the same record?

Était-ce utile?

La solution

I don't know the details of your app but it seems like the process of doing a review widens the window where multiple folks can start a review and then when they commit it ends up being more than two,

One option is to introduce the concept of starting a review. When someone initiates the action of doing a review, they "start" the review. That marks the review as started. The system shouldn't let more than two starting.

You could also make it more advanced by timing out reviews that we're never "submitted" or having the ability to delete a pending review that was started.

Autres conseils

Nhibernate has various concurreny models which you implement in your project based upon your needs.

Have a look at NHibernate-Concurrency

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top