refactor: simplify error handling in database connection pool
This commit is contained in:
parent
3f477ca3b8
commit
a3d3e8f5bd
4 changed files with 4 additions and 6 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
TODOS:
|
TODOS:
|
||||||
- Log email fallite e retry
|
- 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
|
- piu info negli annunci_servizio sheet
|
||||||
- override magico per saltare inserimento strighe caparra e contratto
|
- override magico per saltare inserimento strighe caparra e contratto
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ export const genRicevutaUfficio = async (data: RicevutaData) => {
|
||||||
|
|
||||||
// 3. Get the form
|
// 3. Get the form
|
||||||
const form = pdfDoc.getForm();
|
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
|
// 4. Safely fill fields with Type Casting
|
||||||
// We use try/catch or optional checks in case the field names change in the PDF
|
// We use try/catch or optional checks in case the field names change in the PDF
|
||||||
|
|
|
||||||
|
|
@ -693,7 +693,7 @@ export const getRicevutaData = async (
|
||||||
throw new Error(`Codice fiscale mancante per utente ${ordine.userid}`);
|
throw new Error(`Codice fiscale mancante per utente ${ordine.userid}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(previewSaldo);
|
//console.log(previewSaldo);
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
ordineId: ordine.ordine_id,
|
ordineId: ordine.ordine_id,
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,8 @@ pool.on("error", (err) => {
|
||||||
const pgErr = err as { code?: string };
|
const pgErr = err as { code?: string };
|
||||||
// "admin_shutdown" error sent during backups
|
// "admin_shutdown" error sent during backups
|
||||||
const isAdminShutdown = pgErr.code === "57P01";
|
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);
|
console.error("PG error:", err);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue