Giter Club home page Giter Club logo

Comments (5)

jsumners avatar jsumners commented on July 18, 2024 2

https://jrfom.com/posts/2023/12/15/node-process-management/

from fastify.

climba03003 avatar climba03003 commented on July 18, 2024

My advice is use proper tools to do so, for example SystemD, Container.
And you should never recover the unhandledRejection inside node.js.

from fastify.

MuhammadAli-208 avatar MuhammadAli-208 commented on July 18, 2024

Thanks for the suggestion!
Yeah, I have an idea that it's more related to Node.js exception handling. It seems like the issue could be resolved if I handle exceptions on every promise individually. However, I'm curious if there's a way to handle them more gracefully on a process or global level.

from fastify.

climba03003 avatar climba03003 commented on July 18, 2024

You can listen to the event and gracefully shutdown your application.

process.on('unhandledRejection', (reason, promise) => {
  // logging or something else...
});


process.on('uncaughtException', (err, origin) => {
  // logging or something else...
});

Remember DO NOT restart your application after you face those error, you may face unexpected condition.

from fastify.

Fdawgs avatar Fdawgs commented on July 18, 2024

close-with-grace is pretty handy for this.

Closing as this is not Fastify related.

from fastify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.