fix: Adjustment in the recording of temporary files and periodic cleaning

This commit is contained in:
Davidson Gomes
2023-06-20 14:57:19 -03:00
parent 30cd8a03eb
commit d359949310
11 changed files with 352 additions and 60 deletions

View File

@@ -1,4 +1,4 @@
import { ConfigService } from '../../config/env.config';
import { ConfigService, StoreConf } from '../../config/env.config';
import { IMessageUpModel, MessageUpdateRaw } from '../models';
import { IInsert, Repository } from '../abstract/abstract.repository';
import { join } from 'path';
@@ -28,13 +28,21 @@ export class MessageUpRepository extends Repository {
return { insertCount: insert.length };
}
data.forEach((update) => {
this.writeStore<MessageUpdateRaw>({
path: join(this.storePath, 'message-up', update.owner),
fileName: update.id,
data: update,
const store = this.configService.get<StoreConf>('STORE');
if (store.MESSAGE_UP) {
data.forEach((update) => {
this.writeStore<MessageUpdateRaw>({
path: join(this.storePath, 'message-up', update.owner),
fileName: update.id,
data: update,
});
});
});
return { insertCount: data.length };
}
return { insertCount: 0 };
} catch (error) {
return error;
}