Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

📝 Log results of each house-keeping task (#2491)

Luke Vella48092e42516b
diff --git a/apps/web/src/app/api/house-keeping/[...method]/route.ts b/apps/web/src/app/api/house-keeping/[...method]/route.ts
index c5ceb6dc7..d1dfad924 100644
--- a/apps/web/src/app/api/house-keeping/[...method]/route.ts
+++ b/apps/web/src/app/api/house-keeping/[...method]/route.ts
@@ -1,10 +1,13 @@
import { prisma } from "@rallly/database";
+import { createLogger } from "@rallly/logger";
import { Hono } from "hono";
import { bearerAuth } from "hono/bearer-auth";
import { handle } from "hono/vercel";
const BATCH_SIZE = 100;
+const logger = createLogger("api/house-keeping");
+
const app = new Hono().basePath("/api/house-keeping");
app.use("*", async (c, next) => {
@@ -12,6 +15,8 @@ app.use("*", async (c, next) => {
return bearerAuth({ token: process.env.CRON_SECRET })(c, next);
}
+ logger.error("CRON_SECRET is not set in environment variables");
+
return c.json(
{
error: "CRON_SECRET is not set in environment variables",
@@ -67,6 +72,11 @@ app.get("/delete-inactive-polls", async (c) => {
},
});
+ logger.info(
+ { task: "delete-inactive-polls", markedDeleted },
+ "Marked inactive polls as deleted",
+ );
+
return c.json({
success: true,
summary: {
@@ -102,6 +112,11 @@ app.get("/auto-close-polls", async (c) => {
)
`;
+ logger.info(
+ { task: "auto-close-polls", closed },
+ "Closed polls with all options ended",
+ );
+
return c.json({
success: true,
summary: {
@@ -146,6 +161,11 @@ app.get("/remove-deleted-polls", async (c) => {
totalDeletedPolls += deleted.count;
}
+ logger.info(
+ { task: "remove-deleted-polls", deletedPolls: totalDeletedPolls },
+ "Removed polls marked deleted over 7 days ago",
+ );
+
return c.json({
success: true,
summary: {