PT

@core / jobs

1.1.0 ▾
verificadoMIT
GitHub

Tarefas em segundo plano no Postgres: fila durável, novas tentativas com backoff, cron e endpoint serverless

Código9 arquivosContexto~696 tokensanálise aprovada

A árvore exata que será injetada, após o .genpmignore. Fixada em

src/lib/jobs/cron-auth.tssomente leitura · eef017d
// Protección del endpoint de cron: `Authorization: Bearer <CRON_SECRET>` comparado en tiempo constante.

export function isAuthorizedCron(authorization: string | null | undefined, secret = process.env.CRON_SECRET): boolean {
  if (!secret || secret.length < 32) throw new Error('CRON_SECRET must be set (>= 32 chars)');
  const given = new TextEncoder().encode(authorization ?? '');
  const expected = new TextEncoder().encode(`Bearer ${secret}`);
  let diff = given.length ^ expected.length;
  for (let i = 0; i < expected.length; i++) diff |= (given[i] ?? 0) ^ expected[i]!;
  return diff === 0;
}

Denunciar @core/jobs

Entre com o GitHub para denunciar um pacote.