func handleSignals()

in main.go [68:82]


func handleSignals(rmq mocks.AmqpConnectionInterface) {
	sigChan := make(chan os.Signal, 1) //buffer of 1 signal in case we're not in receiving state when it comes through
	signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM)

	go func() {
		receivedSig := <-sigChan
		log.Printf("INFO handleSignals received %s, shutting down in 5s", receivedSig.String())
		time.Sleep(5 * time.Second)
		closeErr := rmq.Close()
		if closeErr != nil {
			log.Print("ERROR handleSignals could not close connection: ", closeErr)
		}
		os.Exit(0)
	}()
}