diff --git a/apps/backend/src/lib/clickhouse.tsx b/apps/backend/src/lib/clickhouse.tsx index 4d088478e..8ad015fcf 100644 --- a/apps/backend/src/lib/clickhouse.tsx +++ b/apps/backend/src/lib/clickhouse.tsx @@ -17,6 +17,7 @@ export function createClickhouseClient(authType: "admin" | "external", database? password: getEnvVariable("STACK_CLICKHOUSE_EXTERNAL_PASSWORD"), }, database, + request_timeout: 10 * 60 * 1000, // 10 minutes }); } diff --git a/apps/backend/src/lib/email-queue-step.tsx b/apps/backend/src/lib/email-queue-step.tsx index 01f297e0e..09020cfa5 100644 --- a/apps/backend/src/lib/email-queue-step.tsx +++ b/apps/backend/src/lib/email-queue-step.tsx @@ -5,8 +5,8 @@ import { EmailOutboxRecipient, getEmailConfig, } from "@/lib/emails"; import { generateUnsubscribeLink, getNotificationCategoryById, hasNotificationEnabled, listNotificationCategories } from "@/lib/notification-categories"; import { getTenancy, Tenancy } from "@/lib/tenancies"; import { getPrismaClientForTenancy, globalPrismaClient, PrismaClientTransaction } from "@/prisma-client"; -import { withTraceSpan } from "@/utils/telemetry"; import { allPromisesAndWaitUntilEach } from "@/utils/background-tasks"; +import { withTraceSpan } from "@/utils/telemetry"; import { groupBy } from "@stackframe/stack-shared/dist/utils/arrays"; import { getEnvBoolean, getNodeEnvironment } from "@stackframe/stack-shared/dist/utils/env"; import { captureError, errorToNiceString, StackAssertionError, throwErr } from "@stackframe/stack-shared/dist/utils/errors"; @@ -144,11 +144,11 @@ async function logEmailsStuckInSending(): Promise { skippedReason: null, isPaused: false, }, - select: { id: true, tenancyId: true, startedSendingAt: true }, + select: { id: true, tenancyId: true, startedSendingAt: true, to: true, sentAt: true, sendAttemptErrors: true }, }); if (res.length > 0) { captureError("email-queue-step-stuck-in-sending", new StackAssertionError(`${res.length} emails stuck in sending! This should never happen. It was NOT correctly marked as an error! Manual intervention is required.`, { - emails: res.map(e => ({ id: e.id, tenancyId: e.tenancyId, startedSendingAt: e.startedSendingAt })), + emails: res, })); } }