diff --git a/backend/scheduler/src/jobs/streak-expiration-notice.ts b/backend/scheduler/src/jobs/streak-expiration-notice.ts index fd1b01dc6e..da20ecaf78 100644 --- a/backend/scheduler/src/jobs/streak-expiration-notice.ts +++ b/backend/scheduler/src/jobs/streak-expiration-notice.ts @@ -1,8 +1,9 @@ -import { getBettingStreakResetTimeBeforeNow, log } from 'shared/utils' +import { getBettingStreakResetTimeBeforeNow, isProd, log } from 'shared/utils' import { createSupabaseDirectClient } from 'shared/supabase/init' import { createBettingStreakExpiringNotification } from 'shared/create-notification' export const sendStreakExpirationNotification = async () => { + if (!isProd()) return const mostRecentResetTime = getBettingStreakResetTimeBeforeNow() log('Most recent streak reset time', mostRecentResetTime) const pg = createSupabaseDirectClient() diff --git a/backend/shared/src/onboarding-helpers.ts b/backend/shared/src/onboarding-helpers.ts index 2c28568387..db4465c588 100644 --- a/backend/shared/src/onboarding-helpers.ts +++ b/backend/shared/src/onboarding-helpers.ts @@ -8,7 +8,7 @@ import { MARKET_VISIT_BONUS_TOTAL, NEXT_DAY_BONUS, } from 'common/economy' -import { getUser, getUsers, log } from 'shared/utils' +import { getUser, getUsers, isProd, log } from 'shared/utils' import { SignupBonusTxn } from 'common/txn' import { MANIFOLD_AVATAR_URL, @@ -37,6 +37,7 @@ D1 send mana bonus email [deprecated] D2 send creator guide email */ export async function sendOnboardingNotificationsInternal() { + if (!isProd()) return const { recentUserIds } = await getRecentNonLoverUserIds() log( diff --git a/backend/shared/src/weekly-markets-emails.ts b/backend/shared/src/weekly-markets-emails.ts index 33b1522e6d..69afb44345 100644 --- a/backend/shared/src/weekly-markets-emails.ts +++ b/backend/shared/src/weekly-markets-emails.ts @@ -1,6 +1,6 @@ import { chunk } from 'lodash' -import { getPrivateUsersNotSent, getUser, log } from 'shared/utils' +import { getPrivateUsersNotSent, getUser, isProd, log } from 'shared/utils' import { sendInterestingMarketsEmail } from 'shared/emails' import { PrivateUser } from 'common/user' import { getForYouSQL } from 'shared/supabase/search-contracts' @@ -12,6 +12,7 @@ import { userIdsToAverageTopicConversionScores } from 'shared/topic-interests' // Should scale until at least 1000 * 120 = 120k users signed up for emails (70k at writing) const EMAILS_PER_BATCH = 1000 export async function sendWeeklyMarketsEmails() { + if (!isProd()) return const pg = createSupabaseDirectClient() const privateUsers = await getPrivateUsersNotSent( 'trending_markets', diff --git a/backend/shared/src/weekly-portfolio-emails.ts b/backend/shared/src/weekly-portfolio-emails.ts index eb9a44e238..37babaaf17 100644 --- a/backend/shared/src/weekly-portfolio-emails.ts +++ b/backend/shared/src/weekly-portfolio-emails.ts @@ -3,13 +3,7 @@ import { CPMMContract, CPMMMultiContract, } from 'common/contract' -import { - getPrivateUsersNotSent, - getPrivateUser, - getUser, - isProd, - log, -} from 'shared/utils' +import { getPrivateUsersNotSent, getUser, isProd, log } from 'shared/utils' import { filterDefined } from 'common/util/array' import { DAY_MS } from 'common/util/time' import { chunk, partition, sortBy, sum, uniq } from 'lodash' @@ -37,10 +31,13 @@ const WEEKLY_MOVERS_TO_SEND = 6 // This should work until we have at least ~180k users (1000 * 180) export async function sendPortfolioUpdateEmailsToAllUsers() { const pg = createSupabaseDirectClient() + if (!isProd()) return - const privateUsers = isProd() - ? await getPrivateUsersNotSent('profit_loss_updates', USERS_TO_EMAIL, pg) - : filterDefined([await getPrivateUser('6hHpzvRG0pMq8PNJs7RZj2qlZGn2')]) + const privateUsers = await getPrivateUsersNotSent( + 'profit_loss_updates', + USERS_TO_EMAIL, + pg + ) await pg.none( `update private_users set weekly_portfolio_email_sent = true where id = any($1)`,