iptvChannel/main.go
Senis d1923d9708
Update controller concurrency and Dockerfile, provide detailed version info
Enhanced the 'controller.go' file to enforce a maximum concurrency limit of 16. Also made changes in Dockerfile including setting a new repository mirror, adding git for using git commit hash at build which can be displayed through 'version.go'. This commit leads to an improved application performance, more streamlined build process and detailed version information.

Update CI/CD workflow in GitHub Actions

Changed the 'ci.yml' configuration file to trigger build process on each push event for any tag. This change optimizes the workflow to ensure code is tested and integrated on every version increment without waiting for a pull request.
2024-01-15 20:02:31 +08:00

36 lines
705 B
Go

package main
import (
"errors"
"net/http"
"os"
"os/signal"
log "github.com/sirupsen/logrus"
"github.com/thank243/iptvChannel/config"
"github.com/thank243/iptvChannel/controller"
)
func main() {
c, err := controller.New(config.ReadConfig())
if err != nil {
log.Panic(err)
}
go func() {
if err := c.Start(); !errors.Is(err, http.ErrServerClosed) {
log.Panic(err)
}
}()
// Wait for interrupt signal to gracefully shutdown the server with a timeout of 10 seconds.
// Use a buffered channel to avoid missing signals as recommended for signal.Notify
quit := make(chan os.Signal, 1)
signal.Notify(quit, os.Interrupt)
<-quit
if err := c.Stop(); err != nil {
log.Panic(err)
}
}