Graceful shutdown and what SIGTERM starts
Your deploy sends SIGTERM. What your process does in the next thirty seconds decides whether someone gets charged twice.
Things I worked out, written down before I forget them.
Your deploy sends SIGTERM. What your process does in the next thirty seconds decides whether someone gets charged twice.
Monitoring tells you something is broken. Observability tells you what. The gap between those two sentences is three pillars of instrumentation.
A 500 with "something went wrong" is usually a bug you forgot to name. Catch errors in one place and name them properly.
Config is not just your database URL and your Stripe key. It is every decision your code defers until startup.
LIKE '%laptop%' scans every row and has no idea which result matters. An inverted index fixes both problems at once.
A cache is a subset of your data kept somewhere faster. Everything hard about it is deciding which subset, and when to throw it away.
Your signup endpoint should not be waiting on someone else's SMTP server. Push the email into a queue and return.
A database is a text file that also enforces the rules you were planning to enforce in application code, and never gets them wrong.
Sessions, JWTs, API keys, and OAuth solve four different problems. Picking the wrong one costs you revocation.
Frontend validation is for user experience. Backend validation is for data integrity. Skipping the second one turns a 400 into a 500.
Your JavaScript object and the server's Rust struct have nothing in common. Serialization is the agreed-upon format in the middle.
Routing is a lookup table. The method says what you want, the path says where — together they pick exactly one handler.
Routes, methods, status codes and list parameters are decisions you make in an HTTP client, not while writing handlers.
Handlers, services, repositories, middleware, and request context are five answers to one question - where does this line of code belong?
Statelessness, headers, CORS preflights and ETags — the parts of HTTP that show up in a network tab at 2am.