Skip to content

Commit

Permalink
feat: handle SIGTERM and SIGINT gracefully
Browse files Browse the repository at this point in the history
  • Loading branch information
torives authored and gligneul committed Jan 12, 2024
1 parent 210d0ec commit 124c318
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/cartesi-rollups-node/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ package main

import (
"context"
"os/signal"
"syscall"
"time"

"github.com/cartesi/rollups-node/internal/config"
Expand All @@ -15,8 +17,8 @@ func main() {
startTime := time.Now()
var s []services.Service

ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
defer stop()

// add Redis first
s = append(s, newRedis())
Expand Down

0 comments on commit 124c318

Please sign in to comment.