diff options
| author | Hazelnoot <acomputerdog@gmail.com> | 2025-01-26 15:18:18 +0000 |
|---|---|---|
| committer | Hazelnoot <acomputerdog@gmail.com> | 2025-01-26 15:18:18 +0000 |
| commit | 4b104879cd250c96cbbe2e6c0e4f8757367f2f33 (patch) | |
| tree | d471c7b632f8fc737fd7c522ffc5a525467c939f /packages/backend/src | |
| parent | merge: Improve my previous emoji endpoints patch. (!869) (diff) | |
| parent | while we're here, fix the example and comment (diff) | |
| download | sharkey-4b104879cd250c96cbbe2e6c0e4f8757367f2f33.tar.gz sharkey-4b104879cd250c96cbbe2e6c0e4f8757367f2f33.tar.bz2 sharkey-4b104879cd250c96cbbe2e6c0e4f8757367f2f33.zip | |
merge: use "import" settings in more import places (!870)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/870
Approved-by: Marie <github@yuugi.dev>
Approved-by: Hazelnoot <acomputerdog@gmail.com>
Diffstat (limited to 'packages/backend/src')
| -rw-r--r-- | packages/backend/src/queue/processors/ImportCustomEmojisProcessorService.ts | 6 | ||||
| -rw-r--r-- | packages/backend/src/queue/processors/ImportNotesProcessorService.ts | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/packages/backend/src/queue/processors/ImportCustomEmojisProcessorService.ts b/packages/backend/src/queue/processors/ImportCustomEmojisProcessorService.ts index 17ba71df3d..666a709ab9 100644 --- a/packages/backend/src/queue/processors/ImportCustomEmojisProcessorService.ts +++ b/packages/backend/src/queue/processors/ImportCustomEmojisProcessorService.ts @@ -17,6 +17,7 @@ import { bindThis } from '@/decorators.js'; import { QueueLoggerService } from '../QueueLoggerService.js'; import type * as Bull from 'bullmq'; import type { DbUserImportJobData } from '../types.js'; +import type { Config } from '@/config.js'; // TODO: 名前衝突時の動作を選べるようにする @Injectable() @@ -24,6 +25,9 @@ export class ImportCustomEmojisProcessorService { private logger: Logger; constructor( + @Inject(DI.config) + private config: Config, + @Inject(DI.driveFilesRepository) private driveFilesRepository: DriveFilesRepository, @@ -57,7 +61,7 @@ export class ImportCustomEmojisProcessorService { try { fs.writeFileSync(destPath, '', 'binary'); - await this.downloadService.downloadUrl(file.url, destPath); + await this.downloadService.downloadUrl(file.url, destPath, { operationTimeout: this.config.import?.downloadTimeout, maxSize: this.config.import?.maxFileSize }); } catch (e) { // TODO: 何度か再試行 if (e instanceof Error || typeof e === 'string') { this.logger.error(e); diff --git a/packages/backend/src/queue/processors/ImportNotesProcessorService.ts b/packages/backend/src/queue/processors/ImportNotesProcessorService.ts index f89dc46722..ee9819b29f 100644 --- a/packages/backend/src/queue/processors/ImportNotesProcessorService.ts +++ b/packages/backend/src/queue/processors/ImportNotesProcessorService.ts @@ -626,7 +626,7 @@ export class ImportNotesProcessorService { if (!exists) { try { - await this.downloadService.downloadUrl(videos[0].url, filePath); + await this.downloadUrl(videos[0].url, filePath); } catch (e) { // TODO: 何度か再試行 this.logger.error(e instanceof Error ? e : new Error(e as string)); } @@ -651,7 +651,7 @@ export class ImportNotesProcessorService { if (!exists) { try { - await this.downloadService.downloadUrl(file.media_url_https, filePath); + await this.downloadUrl(file.media_url_https, filePath); } catch (e) { // TODO: 何度か再試行 this.logger.error(e instanceof Error ? e : new Error(e as string)); } |