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

View File

@@ -11,8 +11,8 @@ BUCKET_NAME: str = os.getenv('BUCKET_NAME') # type: ignore
EMAIL_SENDER = ('EDUSEG®', 'noreply@eduseg.com.br') EMAIL_SENDER = ('EDUSEG®', 'noreply@eduseg.com.br')
HTTP_CONNECT_TIMEOUT = int(os.environ.get('HTTP_CONNECT_TIMEOUT', 1)) HTTP_CONNECT_TIMEOUT = int(os.environ.get('HTTP_CONNECT_TIMEOUT', 2))
HTTP_READ_TIMEOUT = int(os.environ.get('HTTP_READ_TIMEOUT', 3)) HTTP_READ_TIMEOUT = int(os.environ.get('HTTP_READ_TIMEOUT', 6))
PAPERFORGE_API = 'https://paperforge.saladeaula.digital' PAPERFORGE_API = 'https://paperforge.saladeaula.digital'
CERT_REPORTING_URI = 's3://saladeaula.digital/certs/reporting.html' CERT_REPORTING_URI = 's3://saladeaula.digital/certs/reporting.html'