my own indieAuth provider! indiko.dunkirk.sh/docs
indieauth oauth2-server
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: cleanup expired records

dunkirk.sh 2400bca3 0521c9e0

verified
+18
+18
src/index.ts
··· 254 254 255 255 console.log("[Indiko] running on", env.ORIGIN); 256 256 257 + // Cleanup job: runs every hour to remove expired data 258 + const cleanupJob = setInterval(() => { 259 + const now = Math.floor(Date.now() / 1000); 260 + 261 + const sessionsDeleted = db.query("DELETE FROM sessions WHERE expires_at < ?").run(now); 262 + const challengesDeleted = db.query("DELETE FROM challenges WHERE expires_at < ?").run(now); 263 + const authcodesDeleted = db.query("DELETE FROM authcodes WHERE expires_at < ?").run(now); 264 + 265 + const total = sessionsDeleted.changes + challengesDeleted.changes + authcodesDeleted.changes; 266 + 267 + if (total > 0) { 268 + console.log(`[Cleanup] Removed ${total} expired records (sessions: ${sessionsDeleted.changes}, challenges: ${challengesDeleted.changes}, authcodes: ${authcodesDeleted.changes})`); 269 + } 270 + }, 3600000); // 1 hour in milliseconds 271 + 257 272 let is_shutting_down = false; 258 273 function shutdown(sig: string) { 259 274 if (is_shutting_down) return; 260 275 is_shutting_down = true; 261 276 262 277 console.log(`[Shutdown] triggering shutdown due to ${sig}`); 278 + 279 + clearInterval(cleanupJob); 280 + console.log("[Shutdown] stopped cleanup job"); 263 281 264 282 server.stop(); 265 283 console.log("[Shutdown] stopped server");