Refactor code for improved readability and consistency
- Adjusted formatting in conversationContext.ts for better token estimation readability. - Enhanced readability in indonesianTextNormalizer.ts by formatting multiline replacements. - Reformatted badword lists and whitelists in indonesianTextNormalizer.ts for consistency. - Improved function signatures in messageStore.ts for clarity. - Reformatted messageCapture.ts to enhance readability of channel ID checks. - Cleaned up error logging in messageStore.ts and retentionManager.ts for better clarity. - Reformatted indonesianSlangLexicon.ts for consistent object formatting. - Enhanced URL fetching regex patterns in urlFetcher.ts for better readability. - Simplified query parameter destructuring in analyticsRoutes.ts for cleaner code. - Improved test readability in autoDeleteManager.test.ts and indonesianTextNormalizer.test.ts by formatting expectations. - Cleaned up whitespace in messageCaptureFilter.test.ts for consistency.
This commit is contained in:
@@ -6,10 +6,7 @@ import {
|
||||
voiceRecordingsTable,
|
||||
} from "../database/schema.js";
|
||||
import { createChildLogger } from "../logger.js";
|
||||
import {
|
||||
getExpiredMessages,
|
||||
getRetentionPolicy,
|
||||
} from "./messageStore.js";
|
||||
import { getExpiredMessages, getRetentionPolicy } from "./messageStore.js";
|
||||
import type { RetentionPolicy } from "./types.js";
|
||||
import { and, eq, isNull, lt, sql } from "drizzle-orm";
|
||||
|
||||
@@ -152,7 +149,10 @@ export async function executeAllRetentionPolicies(): Promise<{
|
||||
return summary;
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
logger.error({ error: message }, "Failed to execute all retention policies");
|
||||
logger.error(
|
||||
{ error: message },
|
||||
"Failed to execute all retention policies",
|
||||
);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -161,7 +161,9 @@ export async function executeAllRetentionPolicies(): Promise<{
|
||||
* Starts a periodic retention policy executor
|
||||
* Runs every 24 hours by default
|
||||
*/
|
||||
export function startRetentionPolicyWorker(intervalMs: number = 24 * 60 * 60 * 1000): NodeJS.Timeout {
|
||||
export function startRetentionPolicyWorker(
|
||||
intervalMs: number = 24 * 60 * 60 * 1000,
|
||||
): NodeJS.Timeout {
|
||||
logger.info({ intervalMs }, "Starting retention policy worker");
|
||||
|
||||
const interval = setInterval(async () => {
|
||||
|
||||
Reference in New Issue
Block a user