maxyu1115 / maxyu1115/git-backup-sync

Refactor and fix BranchInfoManager caching behavior

Open
#22 0 comments 0 reactions 1 assignee View on GitHub

@mmmyr is already working on this.

Since Mar 25, 2023.

bug enhancement
Dominant language
TypeScript
Stars
2
Forks
2
PR merge metrics
No merged PRs in 30d

Description

Currently the BranchInfoManager caches the branch info file in memory, to prevent repeated reads. This was intended to speed things up, since most of the time users don't change the branch info file, and with features like autobackup enabled, we frequently need the information from the bbinfo file.

However, this has led to many bugs, such as #20 . There are also bugs when the branch info file is edited outside of the vscode editor, such as the user using vim, or even switching git branches.

Therefore, we need to do a total refactor to the current BranchInfoManager.

My current thoughts are to:

  1. refactor BranchInfoManager to not check file path, but instead have method invalidateCache(), which the extension will call in a variety of situations.
  2. The extension will call invalidateCache() when the config is reloaded. (Or only when the branchInfoPath is changed? )
  3. Then extension will use vscode.workspace.createFileSystemWatcher to monitor the branch info file?

Maybe there are other ways to do this. Worst case scenario we will need to remove caching behavior...

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.