@@ -19,7 +19,7 @@ import {
19
19
S3_BUCKET ,
20
20
SECRET_KEY ,
21
21
} from "./consts.js" ;
22
- import { FileOperationType , ignoreNext , unignoreNext } from "./fileWatcher.js" ;
22
+ import { FileOperationType , ignore , unignore } from "./fileWatcher.js" ;
23
23
24
24
export const s3Client = new S3Client ( {
25
25
region : AWS_REGION ,
@@ -32,9 +32,9 @@ export const s3Client = new S3Client({
32
32
async function syncLastModified ( localPath : string , lastModified ?: Date ) {
33
33
if ( lastModified ) {
34
34
logger . debug ( `syncLastModified: added ${ localPath } to ignore files.` ) ;
35
- ignoreNext ( FileOperationType . Sync , localPath ) ;
35
+ ignore ( FileOperationType . Sync , localPath ) ;
36
36
await utimes ( localPath , lastModified , lastModified ) ;
37
- unignoreNext ( FileOperationType . Sync , localPath ) ;
37
+ unignore ( FileOperationType . Sync , localPath ) ;
38
38
}
39
39
}
40
40
@@ -86,12 +86,12 @@ export async function download(key: string, localPath: string) {
86
86
} ) ,
87
87
) ;
88
88
89
- ignoreNext ( FileOperationType . Sync , localPath ) ;
89
+ ignore ( FileOperationType . Sync , localPath ) ;
90
90
try {
91
91
await mkdir ( localPath , { recursive : true } ) ;
92
92
await syncLastModified ( localPath , LastModified ) ;
93
93
} finally {
94
- unignoreNext ( FileOperationType . Sync , localPath ) ;
94
+ unignore ( FileOperationType . Sync , localPath ) ;
95
95
}
96
96
97
97
logger . info ( `Downloaded: ${ key } ` ) ;
@@ -109,13 +109,13 @@ export async function download(key: string, localPath: string) {
109
109
// We don't manage ignoring potentially new created directories here because that would be a lot of overhead. Instead, if syncing is triggered, we let the upload of the directory handle breaking that chain. (via updating modification time and that timestamp then being the same)
110
110
await mkdir ( dirname ( localPath ) , { recursive : true } ) ;
111
111
112
- ignoreNext ( FileOperationType . Sync , localPath ) ;
112
+ ignore ( FileOperationType . Sync , localPath ) ;
113
113
try {
114
114
const writeStream = createWriteStream ( localPath ) ;
115
115
await pipeline ( Body . transformToWebStream ( ) , writeStream ) ;
116
116
await syncLastModified ( localPath , LastModified ) ;
117
117
} finally {
118
- unignoreNext ( FileOperationType . Sync , localPath ) ;
118
+ unignore ( FileOperationType . Sync , localPath ) ;
119
119
}
120
120
121
121
logger . info ( `Downloaded: ${ key } ` ) ;
0 commit comments