Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: First pass at ignoring signals #271

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

lpradovera
Copy link
Contributor

No description provided.

Comment on lines +42 to +44
if (process.env.IGNORE_SIGNALS) {
return logger.info('Ignoring SIGINT/SIGTERM as requested.')
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lpradovera return if IGNORE_SIGNALS is set so the SDK does not attach listeners with process.on

@bryanrite
Copy link
Member

bryanrite commented Nov 20, 2020

I'm not a huge fan of this solution... ignoring signals solves the problem directly, but is kind of an odd solution, relying on pushing signal handling to the end user for a fairly common scenario of having to clean up or wait for call completion.

On startup we have setup (pre-connect) and ready (post-connect)

On shutdown we only have teardown (post-disconnect)... what we're missing is a pre-disconnect callback method.

I would suggest instead we expose another callback method (name TBD) that allows the user to manage their business logic while shutting down but before its disconnected from Relay.

The result I think is the same, clients would write the same code, but it would be in a SDK supported callback rather than hacking signal handling.

@lpradovera
Copy link
Contributor Author

lpradovera commented Nov 23, 2020 via email

@bryanrite
Copy link
Member

Not really, we should eventually have it for all of them, but we can add it just for Node right now, it's just as much if not less code than this... rather than having a client rely on something we won't support in the future.

@lpradovera
Copy link
Contributor Author

lpradovera commented Nov 23, 2020

Ok, I understand better now. You are right.

@bryanrite
Copy link
Member

Can you take an attempt at it? Would just have to follow whatever is done for teardown, setup, or ready, and probably hook it into gracefulShutdown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants