codeine-cd / codeine

Codeine is a continuous deployment tool that makes product deployment faster and safer through automation and monitoring.
Apache License 2.0
28 stars 7 forks source link

prevent from 2 users to save configuration of the same project at the same time #212

Closed ezraroi closed 6 years ago

ezraroi commented 6 years ago

Currently 2 users who saves the configuration at the same time can revert the changes the other save did

ezraroi commented 6 years ago

1) Prevent 2 concurrent save configuration requests for the save project by locking the project 2) Add etag header when returning the configuration object by the API. when sending save configuration request, the server will look for etag header. If exists, it will first calculate the etag of the configuration from the database and if it is different from what the client sent, it will reject the save. In order to not break existing clients, we will not check this if the etag header is not added to the save request.

@lchayoun what do you think?

ezraroi commented 6 years ago

we will force this... so tools that will break will need to fix. codeine_node_utils will do it also. We will store in memory uuid for each project and this will be the etag

lchayoun commented 6 years ago

@ezraroi we should reject any request without the configuration id Header is the best option? maybe parameter? Not sure about locking the project, in what level?

ezraroi commented 6 years ago

I think we can add a field to the configuration object. This way it will be easier to make the change transparent. Locking can be done in project level in the configuration manager class