Refactor the db; move to *Manager classes

This commit is contained in:
Philipp Heckel 2022-03-03 16:52:07 -05:00
parent f9219d2d96
commit 08846e4cc2
12 changed files with 162 additions and 64 deletions

View file

@ -1,5 +1,5 @@
import db from "./db";
import prefs from "./Prefs";
import subscriptionManager from "./SubscriptionManager";
const delayMillis = 15000; // 15 seconds
const intervalMillis = 1800000; // 30 minutes
@ -26,9 +26,7 @@ class Pruner {
}
console.log(`[Pruner] Pruning notifications older than ${deleteAfterSeconds}s (timestamp ${pruneThresholdTimestamp})`);
try {
await db.notifications
.where("time").below(pruneThresholdTimestamp)
.delete();
await subscriptionManager.pruneNotifications(pruneThresholdTimestamp);
} catch (e) {
console.log(`[Pruner] Error pruning old subscriptions`, e);
}