-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Better context handling and graceful shutdown (#9)
Use go contexts to handle shutting down go routines and closing channels. This largely makes the receiver pattern with the subscriber and firehose structs unecessary. Instead we pass the necessary arguments to the functions together with the context. The functions listen for the context to signal the process should close, so no separate shutdown function is necessary. Fiber is handled as before. The main.go main function now sets up a cancelable context and passes this to the urfave cli run command. A go routine listens for interrupts and if so gracefully signals to shutdown by calling cancel on the context.
- Loading branch information
Showing
5 changed files
with
81 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters