refactor: simplify error handling in database connection pool

This commit is contained in:
Marco Pedone 2026-04-09 11:15:52 +02:00
parent 3f477ca3b8
commit a3d3e8f5bd
4 changed files with 4 additions and 6 deletions

View file

@ -1,5 +1,6 @@
TODOS:
- Log email fallite e retry
- semplificare post notifica interesse conferma in un enum? o comunque un sistema più semplice da gestire, pagamenti da mostrare? o solo un sunto? da aggiornare o solo bonifico?
- piu info negli annunci_servizio sheet
- override magico per saltare inserimento strighe caparra e contratto

View file

@ -23,7 +23,7 @@ export const genRicevutaUfficio = async (data: RicevutaData) => {
// 3. Get the form
const form = pdfDoc.getForm();
console.log(form.getFields().map((field) => field.getName()));
//console.log(form.getFields().map((field) => field.getName()));
// 4. Safely fill fields with Type Casting
// We use try/catch or optional checks in case the field names change in the PDF

View file

@ -693,7 +693,7 @@ export const getRicevutaData = async (
throw new Error(`Codice fiscale mancante per utente ${ordine.userid}`);
}
console.log(previewSaldo);
//console.log(previewSaldo);
const data = {
ordineId: ordine.ordine_id,

View file

@ -30,11 +30,8 @@ pool.on("error", (err) => {
const pgErr = err as { code?: string };
// "admin_shutdown" error sent during backups
const isAdminShutdown = pgErr.code === "57P01";
const hour = new Date().getHours();
// Consider it a backup window if it's between 00:00 and 02:00
const isBackupWindow = hour === 0 || hour === 1;
if (isAdminShutdown && isBackupWindow) return;
if (isAdminShutdown) return;
console.error("PG error:", err);
});