diff --git a/node/cmd/dal/main.go b/node/cmd/dal/main.go index 14449113c..786e3d1ab 100644 --- a/node/cmd/dal/main.go +++ b/node/cmd/dal/main.go @@ -2,16 +2,27 @@ package main import ( "context" + "os" + "os/signal" + "syscall" "bisonai.com/orakl/node/pkg/dal" "github.com/rs/zerolog/log" ) func main() { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + sigCh := make(chan os.Signal, 1) + signal.Notify(sigCh, syscall.SIGINT, syscall.SIGTERM) + go func() { + <-sigCh + cancel() + }() + err := dal.Run(ctx) if err != nil { - log.Fatal().Err(err).Msg("Failed to start dal") - return + log.Fatal().Err(err).Msg("Failed to start DAL") } } diff --git a/node/pkg/dal/tests/main_test.go b/node/pkg/dal/tests/main_test.go index ee3664985..9d28f0f37 100644 --- a/node/pkg/dal/tests/main_test.go +++ b/node/pkg/dal/tests/main_test.go @@ -33,6 +33,7 @@ func testPublishData(ctx context.Context, submissionData aggregator.SubmissionDa } func generateSampleSubmissionData(configId int32, value int64, timestamp time.Time, round int32, symbol string) (*aggregator.SubmissionData, error) { + ctx := context.Background() sampleGlobalAggregate := aggregator.GlobalAggregate{ ConfigID: configId, Value: value, @@ -40,7 +41,7 @@ func generateSampleSubmissionData(configId int32, value int64, timestamp time.Ti Round: round, } - signHelper, err := helper.NewSignHelper("") + signHelper, err := helper.NewSigner(ctx) if err != nil { return nil, err }