mirror of
https://github.com/svemagie/indiekit-endpoint-microsub.git
synced 2026-04-02 15:35:00 +02:00
feat: add startup cleanup for old read items
Runs cleanupAllReadItems on server startup to clean up accumulated read items from all channels, keeping only the 30 most recent per channel per user. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
7
index.js
7
index.js
@@ -6,7 +6,7 @@ import { microsubController } from "./lib/controllers/microsub.js";
|
||||
import { readerController } from "./lib/controllers/reader.js";
|
||||
import { handleMediaProxy } from "./lib/media/proxy.js";
|
||||
import { startScheduler, stopScheduler } from "./lib/polling/scheduler.js";
|
||||
import { createIndexes } from "./lib/storage/items.js";
|
||||
import { cleanupAllReadItems, createIndexes } from "./lib/storage/items.js";
|
||||
import { webmentionReceiver } from "./lib/webmention/receiver.js";
|
||||
import { websubHandler } from "./lib/websub/handler.js";
|
||||
|
||||
@@ -157,6 +157,11 @@ export default class MicrosubEndpoint {
|
||||
createIndexes(indiekit).catch((error) => {
|
||||
console.warn("[Microsub] Index creation failed:", error.message);
|
||||
});
|
||||
|
||||
// Cleanup old read items on startup
|
||||
cleanupAllReadItems(indiekit).catch((error) => {
|
||||
console.warn("[Microsub] Startup cleanup failed:", error.message);
|
||||
});
|
||||
} else {
|
||||
console.warn(
|
||||
"[Microsub] Database not available at init, scheduler not started",
|
||||
|
||||
Reference in New Issue
Block a user