isomerpages / isomercms-backend

A static website builder and host for the Singapore Government
5 stars 1 forks source link

Fix/mutex lock #911

Closed alexanderleegs closed 1 year ago

alexanderleegs commented 1 year ago

Problem

This PR fixes issues with our existing mutex lock. It has been tested on both local dev and staging.

Currently, our route handler behaviour seems to suffer from 2 issues that make our mutex locks not work as intended:

This PR modifies the behaviour of both our write and rollback wrappers to handle this scenario.

In addition, the returned error has been modified from 409 to 423 (Locked) - this is to better reflect the reason for rejecting the request, and also results in a regular error toast on the frontend instead of the special conflict modal that would normally show up for modification of outdated files.

Resolves IS-478

alexanderleegs commented 1 year ago

@alexanderleegs have we retried how this functions with FE with the new 423 error?

Yup, it shows up as an error toast with the message we've specified (Your page could not be updated. Someone else is currently modifying repo a-test-v4. Please try again later.)