[Django]-Concurrency doubts in Django

4๐Ÿ‘

โœ…

  1. Its webserver specific. If you configure it to run in different process, request will be handled in new process. If you configure to have threads it will be in threads.

  2. Yes. Imagine case when, user1 is viewing/editing a object A (retrieved from DB). user2 deletes that object. And then user1 tries to save it. You need to handle such cases explicitly in your code.

    • Most likely the issues will be related to DB. So you can use transactions to help in some cases.
    • In some other cases, you can define strategy. E.g the case mentioned above, when user1 tries to save the object, and its not there in db you can just create one.
๐Ÿ‘คRohan

0๐Ÿ‘

1) webserver specific.

2) Take a look at django-concurrency. It handles concurrent editing using optimistic concurrency control pattern.

๐Ÿ‘คanonymous

Leave a comment