From 783fad90ddabcef79d01460edb36d00c8e1a3734 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 6 Mar 2025 17:45:51 -0300 Subject: [PATCH] Nick: more read replicas --- apps/api/src/lib/extract/team-id-sync.ts | 4 ++-- apps/api/src/services/billing/auto_charge.ts | 4 ++-- apps/api/src/services/webhook.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/api/src/lib/extract/team-id-sync.ts b/apps/api/src/lib/extract/team-id-sync.ts index 8cf21a14..90a32651 100644 --- a/apps/api/src/lib/extract/team-id-sync.ts +++ b/apps/api/src/lib/extract/team-id-sync.ts @@ -1,9 +1,9 @@ -import { supabase_service } from "../../services/supabase"; +import { supabase_rr_service, supabase_service } from "../../services/supabase"; import { logger } from "../logger"; export async function getTeamIdSyncB(teamId: string) { try { - const { data, error } = await supabase_service + const { data, error } = await supabase_rr_service .from("eb-sync") .select("team_id") .eq("team_id", teamId) diff --git a/apps/api/src/services/billing/auto_charge.ts b/apps/api/src/services/billing/auto_charge.ts index ace14c6e..b30be201 100644 --- a/apps/api/src/services/billing/auto_charge.ts +++ b/apps/api/src/services/billing/auto_charge.ts @@ -2,7 +2,7 @@ import { AuthCreditUsageChunk } from "../../controllers/v1/types"; import { getACUC } from "../../controllers/auth"; import { redlock } from "../redlock"; -import { supabase_service } from "../supabase"; +import { supabase_rr_service, supabase_service } from "../supabase"; import { createPaymentIntent } from "./stripe"; import { issueCredits } from "./issue_credits"; import { sendNotification, sendNotificationWithCustomDays } from "../notification/email_notification"; @@ -124,7 +124,7 @@ export async function autoCharge( if (chunk.sub_user_id) { // Fetch the customer's Stripe information const { data: customer, error: customersError } = - await supabase_service + await supabase_rr_service .from("customers") .select("id, stripe_customer_id") .eq("id", chunk.sub_user_id) diff --git a/apps/api/src/services/webhook.ts b/apps/api/src/services/webhook.ts index 75adfe76..6ba9649a 100644 --- a/apps/api/src/services/webhook.ts +++ b/apps/api/src/services/webhook.ts @@ -1,6 +1,6 @@ import axios from "axios"; import { logger } from "../lib/logger"; -import { supabase_service } from "./supabase"; +import { supabase_rr_service, supabase_service } from "./supabase"; import { WebhookEventType } from "../types"; import { configDotenv } from "dotenv"; import { z } from "zod"; @@ -36,7 +36,7 @@ export const callWebhook = async ( // Only fetch the webhook URL from the database if the self-hosted webhook URL and specified webhook are not set // and the USE_DB_AUTHENTICATION environment variable is set to true if (!webhookUrl && useDbAuthentication) { - const { data: webhooksData, error } = await supabase_service + const { data: webhooksData, error } = await supabase_rr_service .from("webhooks") .select("url") .eq("team_id", teamId)