mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
configurable cleanup
This commit is contained in:
@@ -202,8 +202,8 @@ export class AssetUploadService extends BaseService {
|
||||
|
||||
@OnJob({ name: JobName.PartialAssetCleanupQueueAll, queue: QueueName.BackgroundTask })
|
||||
async removeStaleUploads(): Promise<void> {
|
||||
// TODO: make this configurable
|
||||
const createdBefore = DateTime.now().minus({ days: 7 }).toJSDate();
|
||||
const config = await this.getConfig({ withCache: false });
|
||||
const createdBefore = DateTime.now().minus({ hours: config.nightlyTasks.removeStaleUploads.hoursAgo }).toJSDate();
|
||||
let jobs: JobItem[] = [];
|
||||
const assets = this.assetJobRepository.streamForPartialAssetCleanupJob(createdBefore);
|
||||
for await (const asset of assets) {
|
||||
@@ -329,7 +329,7 @@ export class AssetUploadService extends BaseService {
|
||||
const abortEvent = { assetId, abortTime };
|
||||
// only emit if we didn't just abort it ourselves
|
||||
if (!this.onUploadAbort(abortEvent)) {
|
||||
this.eventRepository.serverSend('UploadAbort', abortEvent);
|
||||
this.websocketRepository.serverSend('UploadAbort', abortEvent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user