Repository navigation
fix: cache the ids of the SyftBox folders a new account creates - #9601
Merged
Merged
Conversation
get_syftbox_folder_id and get_personal_syftbox_folder_id cached a folder's id only when they found it on Drive, not when they created it. On a new account, login therefore searched for /SyftBox twice, and the first lookup of the personal folder after login searched Drive again.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a new account logs in, syft creates
/SyftBoxand the personal folder/SyftBox/{version}#{email}, but it didn't cache their ids. Later lookups searched Drive again. Now the id is cached when the folder is created, the same way the archive folder already does it.Changes
get_syftbox_folder_idandget_personal_syftbox_folder_idcache the id whether they find the folder or create it.get_personal_syftbox_folder_id_from_drive, to matchget_syftbox_folder_id_from_drive.Drive calls on a new account:
Before this change,
/SyftBoxwas only cached by accident: creating the personal folder searched for/SyftBoxa second time. On real Drive, a search right after a create can miss the new folder because Drive's search index lags. That could create a second/SyftBox, and a second personal folder makes the next login fail with "Found 2 compatible folders". Caching the created id avoids that second search. I haven't seen this happen; it's a possibility, not an observed bug.Testing
test_login_on_new_account_searches_each_folder_oncecounts Drive calls during login on a new mock account. It fails without the fix (4 searches) and passes with it (2).Asana task