Skip to content

Commit

Permalink
Merge pull request #75 from so1ve/feat/gc-after-enabled
Browse files Browse the repository at this point in the history
feat: clean outdated files after enabled
  • Loading branch information
bangbang93 committed Jun 12, 2024
2 parents 8adeb62 + 0b8f595 commit 7ba465f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ export async function bootstrap(version: string): Promise<void> {
logger.info(`${files.files.length} files`)
try {
await cluster.syncFiles(files, configuration.sync)
logger.info('回收文件')
await cluster.storage.gc(files.files)
} catch (e) {
if (e instanceof HTTPError) {
logger.error({url: e.response.url}, 'download error')
Expand Down Expand Up @@ -79,6 +77,14 @@ export async function bootstrap(version: string): Promise<void> {
cluster.exit(1)
}
}

try {
logger.info('回收文件')
await cluster.storage.gc(files.files)
} catch (e) {
logger.error({err: e}, 'gc error')
}

async function checkFile(lastFileList: IFileList): Promise<void> {
logger.debug('refresh files')
try {
Expand Down

0 comments on commit 7ba465f

Please sign in to comment.