Commit ec586044 authored by Thomas Bella's avatar Thomas Bella

Exit after 5 seconds

parent 48e7aa17
Pipeline #1063 passed with stages
in 2 minutes and 2 seconds
......@@ -5,6 +5,10 @@ import (
"io/ioutil"
"log"
"net/http"
"os"
"os/signal"
"syscall"
"time"
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api"
)
......@@ -66,6 +70,15 @@ func main() {
}
}()
// Exit program after a few seconds
sigs := make(chan os.Signal, 1)
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
go func() {
<-sigs
time.Sleep(time.Second * 5)
os.Exit(0)
}()
// Process incoming messages
for update := range updates {
// Incoming message was nil - something wrong? - Log it
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment