The oracle comparison clean-up job is written and never started

Abierto Apto para principiantes
#688 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
postgresql, redis, typescript

Línea de trabajo

Lee src/jobs/oracleRetention.ts y el bloque “Lending rate retention” de src/index.ts (líneas 220–249); después, inspecciona los patrones de prueba existentes en src/__tests__/oracleRetention.test.ts. Integra la depuración al iniciar y la cola/el worker en main(), con un temporizador horario con unref'd como alternativa si falla la creación de la cola. El trabajo está completo cuando las pruebas cubren la integración al iniciar y la alternativa de Redis, los fallos de depuración se registran sin detener el servicio y las filas antiguas se depuran cada hora.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

area:database difficulty:easy help wanted points:100 Stellar Wave
Background

src/jobs/oracleRetention.ts is a complete retention job for the
oracle_comparisons table. It has a batched delete
(pruneOldOracleComparisons), a per-network wrapper
(pruneAllNetworksOracleComparisons), a queue, a worker and a schedule
(createOracleRetentionQueue, startOracleRetentionWorker,
scheduleOracleRetention). It has a test, src/__tests__/oracleRetention.test.ts.

Nothing calls it. src/index.ts starts the snapshot, lending-rate and
partition jobs, but it never imports oracleRetention. A search of src/ and
scripts/ finds no caller outside the file itself.

Meanwhile src/services/oracleComparison.ts (line 173) inserts into
oracle_comparisons on every comparison run. So the table only grows.

What to build

Start the job from main() in src/index.ts, the same way the lending-rate
job is started a few lines above:

  • run one prune at boot, inside a try/catch that logs and continues;
  • try to start the queue and worker;
  • if Redis is not available, close what was created and fall back to an hourly
    in-process timer with .unref().

Redis being down must not stop the service and must not stop the pruning.

Where to look
  • src/jobs/oracleRetention.ts
  • src/index.ts, the "Lending rate retention" block (lines 220–249) as the
    pattern to copy
  • docs/RUNBOOK.md if it lists the background jobs
Done when
  • oracle_comparisons rows older than ORACLE_COMPARISON_RETENTION_DAYS
    are removed on a running instance (show this on a local database)
  • The job still runs hourly when Redis is down
  • A failed prune is logged and does not crash the process
  • A test covers the wiring (job started, fallback used when the queue
    cannot be created)

Drips Wave · Complexity: Easy · 100 points


Repo: Divinity-Labs/Lens. Install with npm ci, typecheck with
npx tsc --noEmit, test with npm test. Tests are vitest, not jest.
Running jest reports zero tests and proves nothing.

You cannot reach production. Contributors have no access to the deployed
service or its database. Everything must be provable on your own machine. The
Postgres and Redis in docker-compose.yml are enough.

Five generated files are compared byte for byte: openapi.json /
openapi.yaml, the generated tables in README.md, schema.graphql,
clients/typescript/src/schema.d.ts, and the Prisma baseline
prisma/migrations/0_init/migration.sql. The commands that regenerate them are
in the scripts section of package.json (openapi:gen, readme:gen,
graphql:schema:gen, client:gen) and in docs/database-migrations.md. If a
guard fails and the diff looks identical, it is Windows line endings (CRLF),
not your change.

The database is migrated with prisma migrate deploy. Never use
prisma db push. A change to prisma/schema.prisma needs a new migration
folder and a regenerated baseline, or CI fails. Schema drift is not repaired at
start-up any more.

Start-up must stay forgiving. A boot-time check must never stop the whole
service because one optional dependency (Redis, one network's RPC, one venue)
is down. Report it, do not exit.

A CI job that fails at the install step hides every later step. If your
change touches dependencies, check that the steps after install really ran.

Do not weaken a test to make it pass. Never put a secret, a connection
string, or an RPC URL that contains an API key in code, logs, tests or the PR.
Never shorten a Stellar address or contract id; copy it whole from the repo.



Required: Before submitting, join the contributor Telegram so your work can be tracked and counted toward the Stellar Wave: https://t.me/+fxHXq8f1SwlkZDBk

Lenguaje dominante
TypeScript
Estrellas
4
Forks
71
Merge medio
2 d 6 h
PR fusionados (30 d)
24

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Divinity-Labs/Lens

Todos los issues de Divinity-Labs/Lens

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.