fix(server): await thumbnail generation before returning (#3975)

* await sharp command, minor fixes

* removed outdated test
This commit is contained in:
Mert
2023-09-04 19:24:55 -04:00
committed by GitHub
parent 90f9501902
commit 04d4a30471
3 changed files with 3 additions and 8 deletions

View File

@@ -200,12 +200,6 @@ describe(MediaService.name, () => {
expect(assetMock.save).not.toHaveBeenCalledWith();
});
it('should skip thumbnail generate if resize path is missing', async () => {
assetMock.getByIds.mockResolvedValue([assetStub.noResizePath]);
await sut.handleGenerateWebpThumbnail({ id: assetStub.noResizePath.id });
expect(mediaMock.resize).not.toHaveBeenCalled();
});
it('should generate a thumbnail', async () => {
assetMock.getByIds.mockResolvedValue([assetStub.image]);
await sut.handleGenerateWebpThumbnail({ id: assetStub.image.id });

View File

@@ -109,7 +109,7 @@ export class MediaService {
async handleGenerateWebpThumbnail({ id }: IEntityJob) {
const [asset] = await this.assetRepository.getByIds([id]);
if (!asset || !asset.resizePath) {
if (!asset) {
return false;
}