summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.config/example.yml4
-rw-r--r--packages/backend/src/queue/processors/ImportCustomEmojisProcessorService.ts6
-rw-r--r--packages/backend/src/queue/processors/ImportNotesProcessorService.ts4
3 files changed, 9 insertions, 5 deletions
diff --git a/.config/example.yml b/.config/example.yml
index ba8e818b5d..f781b72b91 100644
--- a/.config/example.yml
+++ b/.config/example.yml
@@ -341,9 +341,9 @@ checkActivityPubGetSignature: false
# Upload or download file size limits (bytes)
#maxFileSize: 262144000
-# timeout and maximum size for imports (e.g. note imports)
+# timeout (in milliseconds) and maximum size for imports (e.g. note imports)
#import:
-# downloadTimeout: 30
+# downloadTimeout: 30000
# maxFileSize: 262144000
# PID File of master process
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));
}