isomerpages / isomercms-backend

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

Fix/git file lock #905

Closed alexanderleegs closed 1 year ago

alexanderleegs commented 1 year ago

Problem

This PR resolves issues we currently have with concurrent edits on the same file. As not all git operations are awaited before returning (git push is done async), it becomes possible for a git repo to still be locked when a new user attempts to make a change. However, our existing route handlers only look at the status of our mutex lock, which does not take this into consideration. This PR adds an additional method hasGitFileLock to GitFileSystemService, and extends our existing write and rollback handlers to check for the existence of the git file lock before proceeding.

This PR has been tested on staging.

To test on local dev:

Resolves IS-434.

alexanderleegs commented 1 year ago

code wise ok, whats our test plan for this PR?

We'll need to test this on staging first, since it only gets triggered if the git file system is in place!

UPDATE: it doesn't work :(

QiluXie commented 1 year ago

@alexanderleegs this PR is not ready for review yet, right? Could you turn it to draft if more work is needed.

alexanderleegs commented 1 year ago

@alexanderleegs this PR is not ready for review yet, right? Could you turn it to draft if more work is needed.

Mostly needs testing - not possible to replicate on local so we need to test on staging