kill bridge only when connected

This commit is contained in:
stryan 2021-02-11 14:37:34 -05:00
parent aac90dd113
commit e85f521cb3
1 changed files with 2 additions and 3 deletions

View File

@ -192,13 +192,12 @@ func main() {
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill)
<-sc
// Signal the bridge to exit cleanly
close(Bridge.BridgeDie)
log.Println("OS Signal. Bot shutting down")
// Wait or the bridge to exit cleanly
if Bridge.Connected {
//TODO BridgeDie occasionally panics on send to closed channel
Bridge.BridgeDie <- true
Bridge.WaitExit.Wait()
}
}