@@ -107,7 +107,6 @@ export function formatStorageErrorHint(error: unknown, path: string): string {
107107}
108108
109109let storageMutex : Promise < void > = Promise . resolve ( ) ;
110- let fallbackSeedMutex : Promise < void > = Promise . resolve ( ) ;
111110
112111function withStorageLock < T > ( fn : ( ) => Promise < T > ) : Promise < T > {
113112 const previousMutex = storageMutex ;
@@ -118,15 +117,6 @@ function withStorageLock<T>(fn: () => Promise<T>): Promise<T> {
118117 return previousMutex . then ( fn ) . finally ( ( ) => releaseLock ( ) ) ;
119118}
120119
121- function withFallbackSeedLock < T > ( fn : ( ) => Promise < T > ) : Promise < T > {
122- const previousMutex = fallbackSeedMutex ;
123- let releaseLock : ( ) => void ;
124- fallbackSeedMutex = new Promise < void > ( ( resolve ) => {
125- releaseLock = resolve ;
126- } ) ;
127- return previousMutex . then ( fn ) . finally ( ( ) => releaseLock ( ) ) ;
128- }
129-
130120const WINDOWS_RENAME_RETRY_ATTEMPTS = 5 ;
131121const WINDOWS_RENAME_RETRY_BASE_DELAY_MS = 10 ;
132122const PRE_IMPORT_BACKUP_WRITE_TIMEOUT_MS = 3_000 ;
@@ -770,36 +760,34 @@ async function loadAccountsInternal(
770760 if ( ! globalFallback ) return null ;
771761
772762 if ( persistMigration ) {
773- await withFallbackSeedLock ( async ( ) => {
774- const seedPath = getStoragePath ( ) ;
775- try {
776- await fs . access ( seedPath ) ;
777- return ;
778- } catch ( accessError ) {
779- const accessCode = ( accessError as NodeJS . ErrnoException ) . code ;
780- if ( accessCode !== "ENOENT" ) {
781- log . warn ( "Failed to inspect project seed path before fallback seeding" , {
782- path : seedPath ,
783- error : String ( accessError ) ,
784- } ) ;
785- return ;
786- }
787- // File is missing; proceed with seed write.
788- }
789-
790- try {
791- await persistMigration ( globalFallback ) ;
792- log . info ( "Seeded project account storage from global fallback" , {
793- path : seedPath ,
794- accounts : globalFallback . accounts . length ,
795- } ) ;
796- } catch ( persistError ) {
797- log . warn ( "Failed to seed project storage from global fallback" , {
763+ const seedPath = getStoragePath ( ) ;
764+ try {
765+ await fs . access ( seedPath ) ;
766+ return globalFallback ;
767+ } catch ( accessError ) {
768+ const accessCode = ( accessError as NodeJS . ErrnoException ) . code ;
769+ if ( accessCode !== "ENOENT" ) {
770+ log . warn ( "Failed to inspect project seed path before fallback seeding" , {
798771 path : seedPath ,
799- error : String ( persistError ) ,
772+ error : String ( accessError ) ,
800773 } ) ;
774+ return globalFallback ;
801775 }
802- } ) ;
776+ // File is missing; proceed with seed write.
777+ }
778+
779+ try {
780+ await persistMigration ( globalFallback ) ;
781+ log . info ( "Seeded project account storage from global fallback" , {
782+ path : seedPath ,
783+ accounts : globalFallback . accounts . length ,
784+ } ) ;
785+ } catch ( persistError ) {
786+ log . warn ( "Failed to seed project storage from global fallback" , {
787+ path : seedPath ,
788+ error : String ( persistError ) ,
789+ } ) ;
790+ }
803791 }
804792
805793 return globalFallback ;
0 commit comments