Skip to content
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

Improve branch cache logic #17663

Closed
rarkins opened this issue Sep 7, 2022 · 4 comments · Fixed by #17848
Closed

Improve branch cache logic #17663

rarkins opened this issue Sep 7, 2022 · 4 comments · Fixed by #17848
Assignees
Labels
priority-2-high Bugs impacting wide number of users or very important features status:in-progress Someone is working on implementation type:refactor Refactoring or improving of existing code

Comments

@rarkins
Copy link
Collaborator

rarkins commented Sep 7, 2022

Describe the proposed change(s).

The branch cache should have this function, which is called at the start of branch processing each run: syncBranchCache(branchName, branchSha, baseBranchName, baseBranchSha)

It's logic will be like this:

  • If baseBranchName has changed, delete isModified
  • If branchSha has changed, delete isModified, isConflicted, isBehindBaseBranch, branchFingerprint
  • If baseBranchSha has changed, delete isConflicted, isBehindBaseBranch
  • Now sync the fields (or create the cache for the branch if it didn't exist)

During branch processing we can call setBranchModified(branchName, isModified), setBranchConflicted, setBranchBehindBase, setBranchFingerprint. These don’t need SHAs because we assume they were sync’d earlier in the branch processing.

Towards the end of branch processing, if we have pushed a commit (either branch creation or branch updating) then we call this function: setBranchCommit(branchName, baseBranchName, branchSha, baseBranchSha, branchFingerprint). It should:

  • If a new branch, set all fields
  • If an existing branch, update all fields
  • Set parentSha to equal baseBranchSha
  • Set isModified, isConflicted and isBehindBaseBranch to false

Note: parentSha should not be reset during syncBranchCache() - only during setBranchCommit().

We should remove all git-level caching. It's OK for us to "lose" such existing cache values for one run while we populate the branch cache using the new logic.

@rarkins rarkins added priority-2-high Bugs impacting wide number of users or very important features type:refactor Refactoring or improving of existing code status:requirements Full requirements are not yet known, so implementation should not be started labels Sep 7, 2022
@rarkins
Copy link
Collaborator Author

rarkins commented Sep 7, 2022

This should also fix #17528 because during syncBranchCache() the value for isX will all be reset once a new commit is detected.

@HonkingGoose HonkingGoose added status:in-progress Someone is working on implementation and removed status:requirements Full requirements are not yet known, so implementation should not be started labels Sep 7, 2022
@RahulGautamSingh
Copy link
Collaborator

Should we also invalidate isModified when config.gitIgnoredAuthors change?

@rarkins
Copy link
Collaborator Author

rarkins commented Sep 16, 2022

Yes, but that should be a rare edge case!

@renovate-release
Copy link
Collaborator

🎉 This issue has been resolved in version 32.219.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority-2-high Bugs impacting wide number of users or very important features status:in-progress Someone is working on implementation type:refactor Refactoring or improving of existing code
Projects
None yet
4 participants