Menu

Vercel Functions now support graceful shutdown - Vercel
📰
0

Vercel Functions now support graceful shutdown - Vercel

Vercel News·Tom Lienard·4 days ago
#K8Q4YSVj
#vercel#cleanup#sigterm#signal#tasks#photo
Reading 0:00
15s threshold

Vercel Functions running on Node.js and Python runtimes now support graceful shutdown, giving you up to 500 milliseconds to run cleanup tasks before termination.

When a function is terminated, such as during scale-down, the runtime receives a SIGTERM signal. You can now use this signal to run cleanup tasks like closing database connections or flushing external logs.

process.on('SIGTERM', () => {

console.log('Cleanup goes here');

});

export default {

fetch() {

return new Response('Hi from a Vercel Function!');

}

}

Learn more about the SIGTERM signal.

Read More