Changes
Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
co-authored by
renee-png
parent
83fdf8e4b2
commit
04eced26a1
@@ -2,11 +2,6 @@ import { sendLovableEmail } from '@lovable.dev/email-js'
|
||||
import { createClient } from '@supabase/supabase-js'
|
||||
import { createFileRoute } from '@tanstack/react-router'
|
||||
|
||||
// The email infra tables (email_send_log, email_send_state, etc.) are not in
|
||||
// the generated Database types, so we use an untyped client throughout this
|
||||
// route. Tables are created by the email infra migration.
|
||||
type AnyClient = ReturnType<typeof createClient<any, any, any>>
|
||||
|
||||
const MAX_RETRIES = 5
|
||||
const DEFAULT_BATCH_SIZE = 10
|
||||
const DEFAULT_SEND_DELAY_MS = 200
|
||||
@@ -42,7 +37,7 @@ function getRetryAfterSeconds(error: unknown): number {
|
||||
|
||||
// Move a message to the dead letter queue and log the reason.
|
||||
async function moveToDlq(
|
||||
supabase: AnyClient,
|
||||
supabase: ReturnType<typeof createClient>,
|
||||
queue: string,
|
||||
msg: { msg_id: number; message: Record<string, unknown> },
|
||||
reason: string
|
||||
@@ -94,7 +89,7 @@ export const Route = createFileRoute("/lovable/email/queue/process")({
|
||||
return Response.json({ error: 'Forbidden' }, { status: 403 })
|
||||
}
|
||||
|
||||
const supabase = createClient<any, any, any>(supabaseUrl, supabaseServiceKey)
|
||||
const supabase = createClient(supabaseUrl, supabaseServiceKey)
|
||||
|
||||
// 1. Check rate-limit cooldown and read queue config
|
||||
const { data: state } = await supabase
|
||||
|
||||
Reference in New Issue
Block a user