From b0ca8e51fb21b23859f95406f41dfe1ce273f419 Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Sat, 4 Nov 2023 17:34:11 +0100 Subject: [PATCH] wire up storage cleaner upon server start --- server/client.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/client.ts b/server/client.ts index 648e4aa9..9f7c08d9 100644 --- a/server/client.ts +++ b/server/client.ts @@ -18,6 +18,7 @@ import TextFileMessageStorage from "./plugins/messageStorage/text"; import Network, {IgnoreListItem, NetworkConfig, NetworkWithIrcFramework} from "./models/network"; import ClientManager from "./clientManager"; import {MessageStorage, SearchQuery, SearchResponse} from "./plugins/messageStorage/types"; +import {StorageCleaner} from "./storageCleaner"; type OrderItem = Chan["id"] | Network["uuid"]; type Order = OrderItem[]; @@ -138,6 +139,15 @@ class Client { if (!Config.values.public && client.config.log) { if (Config.values.messageStorage.includes("sqlite")) { client.messageProvider = new SqliteMessageStorage(client.name); + + if (Config.values.storagePolicy.enabled) { + log.info( + `Activating storage cleaner. Policy: ${Config.values.storagePolicy.deletionPolicy}. MaxAge: ${Config.values.storagePolicy.maxAgeDays} days` + ); + const cleaner = new StorageCleaner(client.messageProvider); + cleaner.start(); + } + client.messageStorage.push(client.messageProvider); }