refactor(api): Move media processing to background job

This commit is contained in:
Jesse Wierzbinski 2025-01-06 19:21:57 +01:00
parent dcdc8c7365
commit 80b874e5fb
No known key found for this signature in database
12 changed files with 242 additions and 119 deletions

View file

@ -8,7 +8,6 @@ import { DiskMediaDriver } from "./drivers/disk.ts";
import type { MediaDriver } from "./drivers/media-driver.ts";
import { S3MediaDriver } from "./drivers/s3.ts";
import { BlurhashPreprocessor } from "./preprocessors/blurhash.ts";
import { ImageConversionPreprocessor } from "./preprocessors/image-conversion.ts";
import type { MediaPreprocessor } from "./preprocessors/media-preprocessor.ts";
/**
@ -58,11 +57,6 @@ export class MediaManager {
* Initializes the preprocessors based on the configuration.
*/
private initializePreprocessors(): void {
if (this.config.media.conversion.convert_images) {
this.preprocessors.push(
new ImageConversionPreprocessor(this.config),
);
}
this.preprocessors.push(new BlurhashPreprocessor());
// Add other preprocessors here as needed
}
@ -87,6 +81,7 @@ export class MediaManager {
}
const uploadResult = await this.driver.addFile(processedFile);
return { ...uploadResult, blurhash };
}
/**