Skip to content

Commit

Permalink
Add Controller ID
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeschuurmans committed Aug 6, 2024
1 parent 14e8f82 commit d29dee8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions internal/flipflop/flipflop.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
rctypes "github.com/metal-toolbox/rivets/condition"
"github.com/sirupsen/logrus"
"go.hollow.sh/toolbox/events"
"go.hollow.sh/toolbox/events/registry"
"go.opentelemetry.io/otel"
)

Expand All @@ -28,8 +27,8 @@ type flipflop struct {
cfg *app.Configuration
stream events.Stream
store store.Repository
controllerID registry.ControllerID // assigned when this worker registers itself
name string
controllerID string
facilityCode string
dryrun bool
faultInjection bool
Expand Down Expand Up @@ -96,6 +95,7 @@ func (f *flipflop) Run(ctx context.Context) {
ctrl.WithLogger(f.logger),
ctrl.WithConnectionTimeout(f.cfg.NatsOptions.ConnectTimeout),
)
f.controllerID = nats.ID()

err := nats.Connect(ctx)
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions internal/worker/task_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/sirupsen/logrus"
"go.hollow.sh/toolbox/events/registry"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/trace"
)
Expand All @@ -27,7 +26,7 @@ type TaskHandler struct {
bmc device.Queryor
}

func NewTaskHandler(task *Task, server *model.Asset, publisher ctrl.Publisher, bmc device.Queryor, controllerID registry.ControllerID, logger *logrus.Logger) *TaskHandler {
func NewTaskHandler(task *Task, server *model.Asset, publisher ctrl.Publisher, bmc device.Queryor, controllerID string, logger *logrus.Logger) *TaskHandler {
taskHandler := &TaskHandler{
server: server,
task: task,
Expand Down

0 comments on commit d29dee8

Please sign in to comment.