Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export class DeviceIntegrationPersistenceService extends AbstractKafkaConsumer {
}

private readonly logger = new Logger(DeviceIntegrationPersistenceService.name);
private readonly defaultMetadataSavedCount = 20;

protected registerTopic(): void {
this.addTopic(KafkaTopic.RAW_REQUEST, "DeviceIntegrationPersistence");
Expand Down Expand Up @@ -122,7 +123,7 @@ export class DeviceIntegrationPersistenceService extends AbstractKafkaConsumer {
}

private async deleteOldMetadata(relatedIoTDevice: IoTDevice): Promise<void> {
const countToKeep: number = +process.env.METADATA_SAVED_COUNT || 10;
const countToKeep: number = +process.env.METADATA_SAVED_COUNT || this.defaultMetadataSavedCount;
// Find the oldest item to be kept.
const newestToDelete = await this.receivedMessageMetadataRepository.find({
where: { device: { id: relatedIoTDevice.id } },
Expand Down