@@ -28,8 +28,8 @@ async function renameWithRetry(src: string, dest: string): Promise<void> {
2828export async function moveMemoryIndexFiles ( sourceBase : string , targetBase : string ) : Promise < void > {
2929 const suffixes = [ "" , "-wal" , "-shm" ] ;
3030 for ( const suffix of suffixes ) {
31- const source = $ { sourceBase} ;
32- const target = $ { targetBase} ;
31+ const source = ` ${ sourceBase } ${ suffix } ` ;
32+ const target = ` ${ targetBase } ${ suffix } ` ;
3333 try {
3434 await renameWithRetry ( source , target ) ;
3535 } catch ( err ) {
@@ -42,17 +42,17 @@ export async function moveMemoryIndexFiles(sourceBase: string, targetBase: strin
4242
4343export async function removeMemoryIndexFiles ( basePath : string ) : Promise < void > {
4444 const suffixes = [ "" , "-wal" , "-shm" ] ;
45- await Promise . all ( suffixes . map ( ( suffix ) => fs . rm ( $ { basePath} , { force : true } ) ) ) ;
45+ await Promise . all ( suffixes . map ( ( suffix ) => fs . rm ( ` ${ basePath } ${ suffix } ` , { force : true } ) ) ) ;
4646}
4747
4848export async function swapMemoryIndexFiles ( targetPath : string , tempPath : string ) : Promise < void > {
49- const backupPath = $ { targetPath} . backup - ;
49+ const backupPath = ` ${ targetPath } .backup-${ randomUUID ( ) } ` ;
5050 await moveMemoryIndexFiles ( targetPath , backupPath ) ;
5151 try {
5252 await moveMemoryIndexFiles ( tempPath , targetPath ) ;
5353 } catch ( err ) {
5454 await moveMemoryIndexFiles ( backupPath , targetPath ) ;
55- throw err ;
55+ thror err ;
5656 }
5757 await removeMemoryIndexFiles ( backupPath ) ;
5858}
0 commit comments