Reason to switching where server is started with signal waiting is that - with server we need to handle errors and sometimes do work with things that were opened/started before Echo started serving requests. If that flow is in main flow (outside of goroutine) - it is easier to handle that as e.Start() is anyway blocking until server stops and steps we want to do are after that
also moved all graceful logic to method as it is then more copy/paste friendly
NB: this logic still kills program when timeout for graceful shutdown is exceeded
Reason to switching where server is started with signal waiting is that - with server we need to handle errors and sometimes do work with things that were opened/started before Echo started serving requests. If that flow is in main flow (outside of goroutine) - it is easier to handle that as
e.Start()
is anyway blocking until server stops and steps we want to do are after thatalso moved all graceful logic to method as it is then more copy/paste friendly
NB: this logic still kills program when timeout for graceful shutdown is exceeded