From 1c47ed0e39da8d44edfae1b6f3831ffde62f1655 Mon Sep 17 00:00:00 2001 From: Xen0Xys Date: Wed, 16 Oct 2024 18:59:23 +0200 Subject: [PATCH] Revert ":bug: Try fixing s3 upload bug" This reverts commit 11cc3934038e78b0580941f9badc017851672478. --- .../webtoon/webtoon/webtoon-database.service.ts | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/modules/webtoon/webtoon/webtoon-database.service.ts b/src/modules/webtoon/webtoon/webtoon-database.service.ts index 156072b..640dddb 100644 --- a/src/modules/webtoon/webtoon/webtoon-database.service.ts +++ b/src/modules/webtoon/webtoon/webtoon-database.service.ts @@ -13,7 +13,6 @@ import WebtoonResponse from "./models/responses/webtoon-response"; import MigrationInfosResponse from "../migration/models/responses/migration-infos.response"; import {FileService} from "../../file/file.service"; import {ConfigService} from "@nestjs/config"; -import {MiscService} from "../../misc/misc.service"; @Injectable() export class WebtoonDatabaseService{ @@ -26,7 +25,6 @@ export class WebtoonDatabaseService{ private readonly prismaService: PrismaService, private readonly fileService: FileService, private readonly configService: ConfigService, - private readonly miscService: MiscService, ){} async saveEpisode(webtoon: CachedWebtoonModel, episode: EpisodeModel, episodeData: EpisodeDataModel, force: boolean = false): Promise{ @@ -108,18 +106,7 @@ export class WebtoonDatabaseService{ const batchSize = parseInt(this.configService.get("S3_BATCH_SIZE")); for (let i = 0; i < episodeData.images.length; i += batchSize){ const batch = episodeData.images.slice(i, i + batchSize); - const promises = []; - for(let j = 0; j < batch.length; j++){ - if(batch.slice(0, j).find(image => image === batch[j])) // TODO - promises.push( - new Promise(resolve => { - resolve(this.miscService.getSum(batch[j])); - }) - ); - else - promises.push(this.saveImage(batch[j])); - } - const results = await Promise.all(promises); + const results = await Promise.all(batch.map(buffer => this.saveImage(buffer))); imagesSum.push(...results); } let dbImages: any[] = await tx.images.findMany({