Skip to content

Done, Wait: Share internals, respect exit code#2

Merged
jasonmills merged 2 commits intojasonmills:shutdown_with_exit_codefrom
uber-go:abg/shutdown-update
Sep 28, 2022
Merged

Done, Wait: Share internals, respect exit code#2
jasonmills merged 2 commits intojasonmills:shutdown_with_exit_codefrom
uber-go:abg/shutdown-update

Conversation

@abhinav
Copy link

@abhinav abhinav commented Sep 28, 2022

This is a proposed change to uber-go#912 by @jasonmills
that DRYs up internal state management by unifying
chan os.Signal and chan ShutdownSignal into a single interface
as suggested in this comment:
uber-go#912 (comment)

This change isn't quite right because mapping os.Signal to a
ShutdownSignal currently relies on a goroutine
which isn't reliably shut down -- so we have leaking tests.

Additionally, this fixes two other issues:

  • Wait() channels would not get unblocked if a regular signal (SIGINT) was received
  • App.Run() did not respect the exit code sent to Shutdowner.Shutdown with this new API

This is a proposed change to #912 by @jasonmills
that DRYs up internal state management by unifying
`chan os.Signal` and `chan ShutdownSignal` into a single interface
as suggested in this comment:
#912 (comment)

This change isn't quite right because mapping os.Signal to a
ShutdownSignal currently relies on a goroutine
which isn't reliably shut down -- so we have leaking tests.

Note that this also fixes a behavioral bug in #912:
`Wait()` channels would not resolve if a plain signal was received.
@jasonmills jasonmills merged commit a94d8e2 into jasonmills:shutdown_with_exit_code Sep 28, 2022
@jasonmills jasonmills deleted the abg/shutdown-update branch September 28, 2022 21:42
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.

2 participants