perf(indexer): Cache-Control en los GET publicos de solo lectura (#242) - #283
Merged
David1984TK merged 1 commit intoJul 28, 2026
Merged
Conversation
|
@innocentharuna is attempting to deploy a commit to the david1984tk's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@innocentharuna Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
David1984TK
approved these changes
Jul 28, 2026
David1984TK
left a comment
Owner
There was a problem hiding this comment.
Cache-Control solo en GET de solo lectura (proyectos/eventos/stats/backers), excluido de errores 4xx/5xx explícitamente. No cachea nada de escritura ni datos sensibles nuevos — todo lo que cachea ya era público sin auth. Tests cubren presencia/ausencia de header. CI real en verde. Aprobado.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #242
Descripción
Categoría: Optimización del sistema (menos carga a Supabase)
Cada visita a las páginas públicas dispara los mismos GETs al indexer, y cada uno repite la query completa a Supabase. Las respuestas de solo lectura ahora son cacheables por unos segundos en el navegador y en cualquier CDN/proxy que se ponga delante del indexer.
Cambios
bimex-indexer/api.js: helper jsonCacheable() que agrega Cache-Control: public, max-age=15, stale-while-revalidate=30 (configurable con PUBLIC_CACHE_SECONDS) solo a respuestas 200 de:
GET /proyectos (lista, detalle y aportaciones)
GET /backers/:address/aportaciones
GET /eventos
GET /stats
Sin cambios en faucet (POST), audit CSV ni SSE.
Verificación
npx vitest run pasa sin errores (indexer: 38/38)
Frontend / contrato (no aplica)
Notas para el revisor
15s de frescura es coherente con el cache frontend de #221 (30s TTL) y con la naturaleza de los datos (cambian a ritmo de bloques on-chain). Los errores nunca llevan header de cache.