Remove graceful shutdown

This commit is contained in:
Jacob Gunther 2023-07-21 15:32:59 -05:00
parent d814d6bd05
commit e452e89d66
No known key found for this signature in database
GPG Key ID: 9E6F3F4BF45EC433
2 changed files with 5 additions and 17 deletions

View File

@ -2,12 +2,11 @@ package main
import (
"errors"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"strconv"
"syscall"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cors"
@ -95,11 +94,9 @@ func main() {
defer r.Close()
go ListenAndServe(conf.Host, conf.Port+instanceID)
log.Printf("Listening on %s:%d\n", conf.Host, conf.Port+instanceID)
defer app.Shutdown()
s := make(chan os.Signal, 1)
signal.Notify(s, os.Interrupt, syscall.SIGTERM)
<-s
if err := app.Listen(fmt.Sprintf("%s:%d", conf.Host, conf.Port+instanceID)); err != nil {
panic(err)
}
}

View File

@ -1,14 +1,5 @@
package main
import (
"fmt"
"log"
)
func ListenAndServe(host string, port uint16) {
log.Printf("Listening on %s:%d\n", host, port)
if err := app.Listen(fmt.Sprintf("%s:%d", host, port)); err != nil {
panic(err)
}
}