appwrite / appwrite/appwrite

🚀 Feature: Optimistic Concurrency

Open
#5,348 2 comments 7 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
57.4k
Forks
5.7k
Avg merge
14h 50m
Merged PRs (30d)
276

Description

### 🔖 Feature description

Optimistic concurrency allows to manage the update of a "document or record" when multiple users try to update it at the same time. For instance, user A open the form of document X and start to edit it; after a few seconds/minutes user B open the same form of document X and "edit and save" faster than user A, so, when user A click "save" button a popup or error appears saying that the document has changed (with a button to query the document again).

### 🎤 Pitch

Many backend frameworks implement this out-of-the-box, like .NET abp framework:
https://docs.abp.io/en/abp/latest/Concurrency-Check

And it is a necessary feature for enterprise domains. An example of a use case is manufacturing process:
lets say in the BOM (bill of materials) of a product we have 30 parts, and there are a lot of supervisors that request parts via an APP (that uses appwrite) to start the production in each line; if 2 or more supervisors open the same order (with 100 ordered products) and they request the entire order, without optimistic concurrency 6000 part will be get from inventory instead of 3000, and no body knows that until the parts arrive to the lines or the finished product inventory. Optimistic concurrency avoid the need of comunication between supervisors, or that certains supervisor only can touch certain orders (bad practice in some companies), etc, etc.

Optimistic concurrency helps to simplify those kind of use cases, other example is when someone update the price of a product in an order or buget document.

### 👀 Have you spent some time to check if this issue has been raised before?

- [X] I checked and didn't find similar issue

### 🏢 Have you read the Code of Conduct?

- [X] I have read the [Code of Conduct](https://github.com/appwrite/.github/blob/main/CODE_OF_CONDUCT.md)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.