Skip to content

Commit

Permalink
Revert ":bug: Try fixing s3 upload bug"
Browse files Browse the repository at this point in the history
This reverts commit 11cc393.
  • Loading branch information
Xen0Xys committed Oct 16, 2024
1 parent 11cc393 commit 1c47ed0
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions src/modules/webtoon/webtoon/webtoon-database.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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<void>{
Expand Down Expand Up @@ -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({
Expand Down

0 comments on commit 1c47ed0

Please sign in to comment.