Menu

5 Backend Traps That Pass Code Review Everytime.
📰

5 Backend Traps That Pass Code Review Everytime.

DEV Community: postgres·Ludwig Maingi·1 day ago
#KcG4douV
#devtopostgresql#devto#dev#provider#every
Long article (934 words) — no AI summary yet.
Reading 0:00
15s threshold

My staging app had zero users. Its Postgres instance was awake for 720 hours that month. Every test was green.

Tests verify behavior. They don't verify what the system does when nobody is looking: what it costs, what it stores, what it does when a provider misbehaves. Five gaps like that kept turning up in a multi-tenant commerce backend (Node, Postgres, Redis). Each has a small, mechanical fix.

1. Idle cost: the database that never sleeps

Neon suspends compute after 5 minutes without a query. Anything that touches the database inside that window resets the timer. Four things were doing it:

A health check running SELECT 1 , probed every 15 to 30 seconds

A queue sweeper firing every 5 minutes, with zero orders to sweep

A landing page that pinged /health on mount

A forgotten browser tab polling every 3.5 seconds overnight

The rule: nothing that can happen while nobody is using the app may touch Postgres.

// Liveness answers from memory app . get ( "/health" , ( _req , res ) => res . status ( 200 ) .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.