chanched handlers

This commit is contained in:
2023-08-12 19:26:50 +03:00
parent 85f4b92fa7
commit 17a09f7fb3
28 changed files with 503 additions and 1001 deletions

View File

@@ -2,13 +2,26 @@ package main
import (
"context"
"os"
"os/signal"
"syscall"
"go.unistack.org/micro/v3/logger"
"go.unistack.org/micro/v4/logger"
"go.unistack.org/unistack-org/pkgdash/service"
)
func main() {
ctx := context.Background()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ch := make(chan os.Signal, 1)
signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)
go func() {
sig := <-ch
logger.Infof(ctx, "handle signal %v, exiting", sig)
cancel()
}()
svc, err := service.NewService(ctx)
if err != nil {