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
@@ -51,17 +51,18 @@ export class ExportClipsProcessorService {
@bindThis
public async process(job: Bull.Job<DbJobDataWithUser>): Promise<void> {
this.logger.info(`Exporting clips 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 clips 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 {
const stream = Writable.toWeb(fs.createWriteStream(path, { flags: 'a' }));
@@ -75,12 +76,12 @@ export class ExportClipsProcessorService {
await writer.write(']');
await writer.close();
this.logger.succ(`Exported to: ${path}`);
this.logger.debug(`Exported to: ${path}`);
const fileName = 'clips-' + 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: 'clip',