FlareStart
HomeNewsHow ToSources
FlareStart

Where developers start their day. All the tech news & tutorials that matter, in one place.

Quick Links

  • Home
  • News
  • Tutorials
  • Sources
  • Privacy Policy

Connect

© 2026 FlareStart. All rights reserved.

Back to articles
Graceful Shutdown in Node.js: Stop Dropping Requests
How-ToDevOps

Graceful Shutdown in Node.js: Stop Dropping Requests

via Dev.to DevOpsYoung Gao3h ago

Graceful Shutdown in Node.js: Stop Dropping Requests Your server gets a SIGTERM. It dies immediately. In-flight requests get 502s. Here is how to shut down properly. The Basic Pattern import http from " http " ; let isShuttingDown = false ; const server = http . createServer ( app ); async function gracefulShutdown ( signal : string ) { isShuttingDown = true ; server . close (); const timeout = setTimeout (() => process . exit ( 1 ), 30000 ); await Promise . all ([ closeDatabase (), closeRedis (), flushLogs ()]); clearTimeout ( timeout ); process . exit ( 0 ); } process . on ( " SIGTERM " , () => gracefulShutdown ( " SIGTERM " )); process . on ( " SIGINT " , () => gracefulShutdown ( " SIGINT " )); Health Check During Shutdown app . get ( " /health " , ( req , res ) => { if ( isShuttingDown ) return res . status ( 503 ). json ({ status : " shutting_down " }); res . json ({ status : " healthy " }); }); Returning 503 tells the load balancer to stop sending new traffic. What to Clean Up St

Continue reading on Dev.to DevOps

Opens in a new tab

Read Full Article
6 views

Related Articles

I Got a $40 Parking Fine, So I’m Building an App That Fixes It
How-To

I Got a $40 Parking Fine, So I’m Building an App That Fixes It

Medium Programming • 3h ago

Here Is What Programming Taught Me About Solving Real-World Problems
How-To

Here Is What Programming Taught Me About Solving Real-World Problems

Medium Programming • 4h ago

How to Add a Custom Tool to Your MCP Server (Step by Step)
How-To

How to Add a Custom Tool to Your MCP Server (Step by Step)

Dev.to Tutorial • 7h ago

I Was Great at Power BI — Until I Realized I Was Useless in Real Projects
How-To

I Was Great at Power BI — Until I Realized I Was Useless in Real Projects

Medium Programming • 7h ago

I Studied What the Top 0.1%
How-To

I Studied What the Top 0.1%

Medium Programming • 15h ago

Discover More Articles