1
0

reduce log spam from import/export processes

This commit is contained in:
Hazelnoot
2025-05-22 09:56:37 -04:00
parent 12acad0654
commit 8e30744bb9
17 changed files with 114 additions and 78 deletions
@@ -120,17 +120,18 @@ export class ExportNotesProcessorService {
@bindThis
public async process(job: Bull.Job<DbJobDataWithUser>): Promise<void> {
this.logger.info(`Exporting notes of ${job.data.user.id} ...`);
const user = await this.usersRepository.findOneBy({ id: job.data.user.id });
if (user == null) {
this.logger.debug(`Skip: user ${job.data.user.id} does not exist`);
return;
}
this.logger.info(`Exporting notes of ${job.data.user.id} ...`);
// Create temp file
const [path, cleanup] = await createTemp();
this.logger.info(`Temp file is ${path}`);
this.logger.debug(`Temp file is ${path}`);
try {
// メモリが足りなくならないようにストリームで処理する
@@ -146,12 +147,12 @@ export class ExportNotesProcessorService {
.pipeThrough(new TextEncoderStream())
.pipeTo(new FileWriterStream(path));
this.logger.succ(`Exported to: ${path}`);
this.logger.debug(`Exported to: ${path}`);
const fileName = 'notes-' + dateFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss') + '.json';
const driveFile = await this.driveService.addFile({ user, path, name: fileName, force: true, ext: 'json' });
this.logger.succ(`Exported to: ${driveFile.id}`);
this.logger.debug(`Exported to: ${driveFile.id}`);
this.notificationService.createNotification(user.id, 'exportCompleted', {
exportedEntity: 'note',