Skip to content

Commit

Permalink
wire up storage cleaner upon server start
Browse files Browse the repository at this point in the history
  • Loading branch information
brunnre8 committed Dec 24, 2023
1 parent 21b1152 commit b0ca8e5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions server/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit b0ca8e5

Please sign in to comment.