Fixed orphaned media flush running on every startup.
This commit is contained in:
parent
3a0e815387
commit
91c490d153
|
@ -323,7 +323,6 @@ const { argv } = yargs
|
|||
describe: 'Remove all orphaned media items from database and disk.',
|
||||
type: 'boolean',
|
||||
alias: 'flush-media',
|
||||
default: config.media.flushOrphaned,
|
||||
})
|
||||
.option('flush-media-files', {
|
||||
describe: 'Remove files from storage when flushing media.',
|
||||
|
|
|
@ -1056,6 +1056,11 @@ async function deleteS3Objects(allMedia) {
|
|||
}
|
||||
|
||||
async function flushOrphanedMedia(stage = 1) {
|
||||
if (!config.media.flushOrphaned) {
|
||||
logger.verbose('Orphaned media flush skipped, disabled in config');
|
||||
return;
|
||||
}
|
||||
|
||||
logger.info(`Flushing orphaned media, stage ${stage}`);
|
||||
|
||||
const orphanedMedia = await knex('media')
|
||||
|
|
Loading…
Reference in New Issue