mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2025-02-24 21:08:41 +01:00
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>
This commit is contained in:
commit
4b104879cd
3 changed files with 9 additions and 5 deletions
.config
packages/backend/src/queue/processors
|
@ -341,9 +341,9 @@ checkActivityPubGetSignature: false
|
||||||
# Upload or download file size limits (bytes)
|
# Upload or download file size limits (bytes)
|
||||||
#maxFileSize: 262144000
|
#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:
|
#import:
|
||||||
# downloadTimeout: 30
|
# downloadTimeout: 30000
|
||||||
# maxFileSize: 262144000
|
# maxFileSize: 262144000
|
||||||
|
|
||||||
# PID File of master process
|
# PID File of master process
|
||||||
|
|
|
@ -17,6 +17,7 @@ import { bindThis } from '@/decorators.js';
|
||||||
import { QueueLoggerService } from '../QueueLoggerService.js';
|
import { QueueLoggerService } from '../QueueLoggerService.js';
|
||||||
import type * as Bull from 'bullmq';
|
import type * as Bull from 'bullmq';
|
||||||
import type { DbUserImportJobData } from '../types.js';
|
import type { DbUserImportJobData } from '../types.js';
|
||||||
|
import type { Config } from '@/config.js';
|
||||||
|
|
||||||
// TODO: 名前衝突時の動作を選べるようにする
|
// TODO: 名前衝突時の動作を選べるようにする
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
@ -24,6 +25,9 @@ export class ImportCustomEmojisProcessorService {
|
||||||
private logger: Logger;
|
private logger: Logger;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
@Inject(DI.config)
|
||||||
|
private config: Config,
|
||||||
|
|
||||||
@Inject(DI.driveFilesRepository)
|
@Inject(DI.driveFilesRepository)
|
||||||
private driveFilesRepository: DriveFilesRepository,
|
private driveFilesRepository: DriveFilesRepository,
|
||||||
|
|
||||||
|
@ -57,7 +61,7 @@ export class ImportCustomEmojisProcessorService {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
fs.writeFileSync(destPath, '', 'binary');
|
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: 何度か再試行
|
} catch (e) { // TODO: 何度か再試行
|
||||||
if (e instanceof Error || typeof e === 'string') {
|
if (e instanceof Error || typeof e === 'string') {
|
||||||
this.logger.error(e);
|
this.logger.error(e);
|
||||||
|
|
|
@ -626,7 +626,7 @@ export class ImportNotesProcessorService {
|
||||||
|
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
try {
|
try {
|
||||||
await this.downloadService.downloadUrl(videos[0].url, filePath);
|
await this.downloadUrl(videos[0].url, filePath);
|
||||||
} catch (e) { // TODO: 何度か再試行
|
} catch (e) { // TODO: 何度か再試行
|
||||||
this.logger.error(e instanceof Error ? e : new Error(e as string));
|
this.logger.error(e instanceof Error ? e : new Error(e as string));
|
||||||
}
|
}
|
||||||
|
@ -651,7 +651,7 @@ export class ImportNotesProcessorService {
|
||||||
|
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
try {
|
try {
|
||||||
await this.downloadService.downloadUrl(file.media_url_https, filePath);
|
await this.downloadUrl(file.media_url_https, filePath);
|
||||||
} catch (e) { // TODO: 何度か再試行
|
} catch (e) { // TODO: 何度か再試行
|
||||||
this.logger.error(e instanceof Error ? e : new Error(e as string));
|
this.logger.error(e instanceof Error ? e : new Error(e as string));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue