Skip to content

Commit

Permalink
fix: ControllerState proto enum references, now that the enum has bee…
Browse files Browse the repository at this point in the history
…n deleted from the proto file (#1288)

Fixes what PR #1282 broke.
Removed stale references to the `ControllerState` proto enum, then ran
`buf generate`
  • Loading branch information
deniseli authored Apr 17, 2024
1 parent 398a85d commit 34650d7
Show file tree
Hide file tree
Showing 7 changed files with 382 additions and 542 deletions.
1 change: 0 additions & 1 deletion backend/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,6 @@ func (s *Service) Status(ctx context.Context, req *connect.Request[ftlv1.StatusR
return &ftlv1.StatusResponse_Controller{
Key: c.Key.String(),
Endpoint: c.Endpoint,
State: c.State.ToProto(),
}
}),
Runners: protoRunners,
Expand Down
8 changes: 0 additions & 8 deletions backend/controller/dal/dal.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,6 @@ const (
ControllerStateDead = ControllerState(sql.ControllerStateDead)
)

func ControllerStateFromProto(state ftlv1.ControllerState) ControllerState {
return ControllerState(strings.ToLower(strings.TrimPrefix(state.String(), "CONTROLLER_")))
}

func (s ControllerState) ToProto() ftlv1.ControllerState {
return ftlv1.ControllerState(ftlv1.ControllerState_value["CONTROLLER_"+strings.ToUpper(string(s))])
}

type RequestOrigin string

const (
Expand Down
5 changes: 0 additions & 5 deletions backend/controller/dal/dal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,6 @@ func TestRunnerStateFromProto(t *testing.T) {
assert.Equal(t, RunnerStateIdle, RunnerStateFromProto(state))
}

func TestControllerStateFromProto(t *testing.T) {
state := ftlv1.ControllerState_CONTROLLER_LIVE
assert.Equal(t, ControllerStateLive, ControllerStateFromProto(state))
}

func normaliseEvents(events []Event) []Event {
for i := range len(events) {
event := events[i]
Expand Down
856 changes: 380 additions & 476 deletions backend/protos/xyz/block/ftl/v1/ftl.pb.go

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions cmd/ftl/cmd_serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,7 @@ func waitForControllerOnline(ctx context.Context, startupTimeout time.Duration,
for {
select {
case <-ticker.C:
_, err := client.Status(ctx, connect.NewRequest(&ftlv1.StatusRequest{
AllControllers: true,
}))
_, err := client.Status(ctx, connect.NewRequest(&ftlv1.StatusRequest{}))
if err != nil {
logger.Tracef("Error getting status, retrying...: %v", err)
continue // retry
Expand Down
6 changes: 1 addition & 5 deletions cmd/ftl/cmd_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ type statusCmd struct {
}

func (s *statusCmd) Run(ctx context.Context, client ftlv1connect.ControllerServiceClient) error {
status, err := client.Status(ctx, connect.NewRequest(&ftlv1.StatusRequest{
AllControllers: s.All || s.AllControllers,
AllRunners: s.All || s.AllRunners,
AllIngressRoutes: s.All || s.AllIngressRoutes,
}))
status, err := client.Status(ctx, connect.NewRequest(&ftlv1.StatusRequest{}))
if err != nil {
return err
}
Expand Down
44 changes: 0 additions & 44 deletions frontend/src/protos/xyz/block/ftl/v1/ftl_pb.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 34650d7

Please sign in to comment.