(optional) The gRPC server
These servers are shut down gracefully by calling some kind of Stop or Shutdown function from main.go after backgroundCtx is canceled, which is done when the signal receives an os.Interupt (Ctrl-c) signal.
Other than that there are the background routines:
Incoming invoice gRPC subscription routine
Payment tracking routines
Webhook dispatching routines
These are also canceled by canceling the backgroundCtx context. The waitgroup waits until all processes are finished before the program is exited.
Fixes #285 Based on this article.
We need to shutdown a maximum of 3 servers:
Stop
orShutdown
function frommain.go
afterbackgroundCtx
is canceled, which is done when the signal receives anos.Interupt
(Ctrl-c) signal.Other than that there are the background routines:
These are also canceled by canceling the
backgroundCtx
context. The waitgroup waits until all processes are finished before the program is exited.