gajus / lightship

Abstracts readiness, liveness and startup checks and graceful shutdown of Node.js services running in Kubernetes.
Other
517 stars 33 forks source link

Can I pass parameters to shutdown()? #4

Closed vprasanth closed 5 years ago

vprasanth commented 5 years ago

I assumed I could, but looks like I can't. I send a PR if you like.

gajus commented 5 years ago

Can you illustrate what do you mean?

Shutdown is a custom function that you provide yourself.

vprasanth commented 5 years ago

Sure

lightship.registerShutdownHandler((msg) => {
  console.log(msg);
  // do some task
});

// some error scenario
if (err) {
  lightship.shutdown(err);
}

Perhaps I misunderstood what registerShutdownHandler does. Perhaps it's just a way to setup multiple functions to be executed when shutdown() is called. I was thinking I could also pass parameters to those functions

gajus commented 5 years ago

it's just a way to setup multiple functions to be executed when shutdown() is called

That^