update configs

This commit is contained in:
2026-01-27 14:30:30 -03:00
parent d5db9b6eff
commit f539d78f14
3 changed files with 9 additions and 6 deletions

View File

@@ -1,3 +1,5 @@
export const TZ = 'America/Sao_Paulo'
export const CACHE_NAME = 'saladeaula.digital'
export const CACHE_TTL_SECONDS = 60 * 10
export const INTERNAL_EMAIL_DOMAIN = 'users.noreply.saladeaula.digital'
export const RYBBIT_SITE_ID = '83748b35413d'

View File

@@ -3,6 +3,7 @@ import { createContext, redirect, type LoaderFunctionArgs } from 'react-router'
import { userContext } from '@repo/auth/context'
import { request as req } from '@repo/util/request'
import { CACHE_NAME, CACHE_TTL_SECONDS } from '@/conf'
import type { Address } from '@/routes/_.$orgid.enrollments.buy/review'
export type Subscription = {
@@ -52,7 +53,7 @@ export const workspaceMiddleware = async (
return next()
}
console.log('Cold start')
console.log('Cache miss')
const r = await req({
url: `/users/${user.sub}/orgs?limit=25`,
@@ -122,7 +123,7 @@ function buildWorkspaceCacheKey(
async function getWorkspaceFromCache(
key: Request
): Promise<WorkspaceContextProps | null> {
const cache: Cache = await caches.open('saladeaula.digital')
const cache: Cache = await caches.open(CACHE_NAME)
const cached: Response | undefined = await cache.match(key)
if (!cached) {
@@ -136,12 +137,12 @@ async function saveToCache(
key: Request,
workspace: WorkspaceContextProps
): Promise<void> {
const cache: Cache = await caches.open('saladeaula.digital')
const cache: Cache = await caches.open(CACHE_NAME)
const response: Response = new Response(JSON.stringify(workspace), {
headers: {
'Content-Type': 'application/json',
'Cache-Control': `public, max-age=${60 * 10}`
'Cache-Control': `public, max-age=${CACHE_TTL_SECONDS}`
}
})