diff --git a/cmd/fermentord/loop.go b/cmd/fermentord/loop.go index 63f91ea..706893d 100644 --- a/cmd/fermentord/loop.go +++ b/cmd/fermentord/loop.go @@ -36,9 +36,6 @@ func mainLoop(ctx context.Context, wg *sync.WaitGroup, js nats.JetStream, config // Controller ctrl := controllers.NewChamberController("Chamber 1", *config) - // NATS - ingest := dwingest.NewDWIngest() - // Configuration reload loadConfiguration := func() { temperature.ConfigUpdate <- *config @@ -52,6 +49,9 @@ func mainLoop(ctx context.Context, wg *sync.WaitGroup, js nats.JetStream, config loadConfiguration() viper.WatchConfig() + // NATS + ingest := dwingest.NewDWIngest() + gpio, err := hw.NewGpio() if err != nil { hub.CaptureException(err) diff --git a/cmd/fermentord/main.go b/cmd/fermentord/main.go index 608b55b..0a5bd27 100644 --- a/cmd/fermentord/main.go +++ b/cmd/fermentord/main.go @@ -41,18 +41,6 @@ func main() { log.Fatal(err) } - _, err = js.AddStream(&nats.StreamConfig{ - Name: config.NATS.Stream, - Subjects: []string{ - fmt.Sprintf("%v.*", config.NATS.Stream), - }, - Replicas: 2, - Retention: nats.WorkQueuePolicy, - }) - if err != nil { - log.Fatal(err) - } - // HTTP mux := http.NewServeMux() srv := &http.Server{ diff --git a/internal/dwingest/nats.go b/internal/dwingest/nats.go index e219cb5..d72efae 100644 --- a/internal/dwingest/nats.go +++ b/internal/dwingest/nats.go @@ -67,7 +67,6 @@ func (p *DWIngest) Run(ctx context.Context, wg *sync.WaitGroup, js nats.JetStrea return } - } }