feat: add auto update
This commit is contained in:
@ -18,6 +18,7 @@ import (
|
||||
"github.com/containarr/server/internal/broker"
|
||||
grpcgateway "github.com/containarr/server/internal/grpc"
|
||||
agentv1 "github.com/containarr/server/internal/proto/agentv1"
|
||||
"github.com/containarr/server/internal/scheduler"
|
||||
"github.com/containarr/server/internal/store"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
@ -39,6 +40,14 @@ func main() {
|
||||
reg := grpcgateway.NewRegistry()
|
||||
brk := broker.New()
|
||||
|
||||
// Root context cancelled on shutdown signal.
|
||||
rootCtx, rootCancel := context.WithCancel(context.Background())
|
||||
defer rootCancel()
|
||||
|
||||
// Scheduler.
|
||||
sched := scheduler.New(scheduler.NewStoreAdapter(db), reg)
|
||||
go sched.Start(rootCtx)
|
||||
|
||||
// gRPC server.
|
||||
gw := grpcgateway.NewGateway(db, reg, brk)
|
||||
grpcServer := grpc.NewServer()
|
||||
@ -76,6 +85,7 @@ func main() {
|
||||
<-quit
|
||||
|
||||
slog.Info("shutting down")
|
||||
rootCancel()
|
||||
grpcServer.GracefulStop()
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
|
||||
Reference in New Issue
Block a user