-
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: invalidate persisted cache #635
Conversation
workspace.Get().ChangeWorkspaceFolders(bgCtx, params) | ||
command.HandleFolders(bgCtx, srv, di.Notifier()) | ||
changedFolders := workspace.Get().ChangeWorkspaceFolders(params) | ||
command.HandleFolders(bgCtx, srv, di.Notifier(), di.ScanPersister()) |
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 moved the persister init logic to the folder handlers
This refactoring here was to make sure that the persister is initialized before a new f.ScanFolder is triggered for the new added folder
for _, folder := range params.Event.Removed { | ||
w.RemoveFolder(uri.PathFromUri(folder.Uri)) | ||
} | ||
|
||
var changedWorkspaceFolders []*Folder |
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 is to avoid triggering scan before initializing the persister.
Caller is responsible for calling the scan for the new added folders
@@ -38,6 +39,10 @@ const ( | |||
SchemaVersion = "v1" | |||
) | |||
|
|||
var ( | |||
ExpirationInSeconds = 12 * 60 * 60 |
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 is not a constant to be able to override it in tests
@@ -73,7 +73,7 @@ func Test_TrustFoldersAndScan_shouldAddFoldersToTrustedFoldersAndTriggerScan(t * | |||
}, time.Second, time.Millisecond, "scanner should be called after trust is granted") | |||
} | |||
|
|||
func Test_AddAndRemoveFoldersAndTriggerScan(t *testing.T) { | |||
func Test_AddAndRemoveFoldersAndReturnFolderList(t *testing.T) { |
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.
Where do you test the extracted trigger scan path now?
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.
in server_test Test_workspaceDidChangeWorkspaceFolders_shouldProcessChanges it checks if folder.Scanned()
I think it should be enough, wdyt ?
Description
Checklist