Repository navigation
Use DB lock to prevent concurrent syncs for the same project - #4418
Conversation
This should prevent issues if a previous git clone failed, leaving behind a broken folder.
eemeli
left a comment
There was a problem hiding this comment.
The changes to the git clone seem completely disconnected from using a DB lock to prevent concurrent syncs for the same project, and should be considered separately.
The core idea of relying on the Sync table data does seem quite good.
| if prev_busy: | ||
| raise RuntimeError( | ||
| f"[{project.slug}] Sync aborted: Previous sync still running." | ||
| ) |
There was a problem hiding this comment.
The contents of the first if prev_busy block should be included here, rather than in the transaction, provided that it's the previous sync rows that are locked, and not the project.
There was a problem hiding this comment.
I've removed the tmp folder approach, and explained why the lock is on the project.
For now, I kept "remove folder when failing to pull" and "use better names for checkout folders". I'd like to avoid having to split them in a separate issue and PR.
eemeli
left a comment
There was a problem hiding this comment.
The logic seems sound now; just need to clean up the LLM-ish comments.
Those are very much flod-made comments, but OK ;-) |
There are 3 changes:
Make the clone more reliable by removing the folder in case of clone failure.Third commit to make the sync's folder name more readable by removing username and host from SCP-like URLs.Fixes #4387 and fixes #3887.