-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Use work trees instead of copying the whole directory #553
Conversation
799a2ef
to
90c3578
Compare
// create worktree | ||
const git = simpleGit(cachedRepoRoot) | ||
// fetch upstream version of the branch - well we need to fetch all because we do not know where the commits are located we need to cherry-pick | ||
await git.fetch(['-p', '--all']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can cause race conditions if ran on the cache directory.
I've had this happen before.
Multiple runs can happen at the same time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiple runs can happen at the same time
⚠️
How could this happen? There is a concurrency of 1 in queue.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I honestly don't even remember 🙈
You can see in the old code I was keeping the cache updated initially, but that created issues 🤷
|
||
let queue: PQueue | ||
|
||
export const addToQueue = (task: Task): Promise<void> => { | ||
export async function addToQueue(task: Task): Promise<void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tssss 😁
Did you encounter some slow backports @susnux ? |
The recent backport bot issues with dirty repository. Using worktrees will never touch the "original" repository, moreover it does not require to copy all ~4GB of the |
This should speed up backports by not copying the repository but create a clean work tree with the required branches set. Signed-off-by: Ferdinand Thiessen <[email protected]>
90c3578
to
4bc27eb
Compare
The original cached repository was never touched before. :) Everything runs on ssd, copying 4GB takes barely a few seconds. |
Yeah saw that, but then I already starting using worktrees and I thought maybe you consider this a nice to have (not sure on what hardware this runs but probably copying 4GB takes always quite some time 😅 |
I would rather merge it and deploy it on a day you and i are both ready to focus on it in case something needs adjusting if that's ok 👍 |
Conference? |
This should speed up backports by not copying the repository but create a clean work tree with the required branches set.
Best reviewed without whitespace: https://github.com/nextcloud/backportbot/pull/553/files?diff=split&w=1