From abc08c642d16f5f87538ccc907d65a7629d9690f Mon Sep 17 00:00:00 2001 From: Juho Makinen Date: Tue, 7 Jan 2025 15:51:15 +1100 Subject: [PATCH] chore: remove event field that is always true --- internal/schema/schemaeventsource/schemaeventsource.go | 7 +------ .../schema/schemaeventsource/schemaeventsource_test.go | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/internal/schema/schemaeventsource/schemaeventsource.go b/internal/schema/schemaeventsource/schemaeventsource.go index 30525556e..ba433607c 100644 --- a/internal/schema/schemaeventsource/schemaeventsource.go +++ b/internal/schema/schemaeventsource/schemaeventsource.go @@ -44,8 +44,6 @@ type EventRemove struct { // None for builtin modules. Deployment optional.Option[model.DeploymentKey] Module *schema.Module - // True if the underlying module was deleted in addition to the deployment itself. - Deleted bool schema *schema.Schema more bool @@ -136,9 +134,7 @@ func (e EventSource) Publish(event Event) { clone := reflect.DeepCopy(e.View()) switch event := event.(type) { case EventRemove: - if event.Deleted { - clone.Modules = slices.DeleteFunc(clone.Modules, func(m *schema.Module) bool { return m.Name == event.Module.Name }) - } + clone.Modules = slices.DeleteFunc(clone.Modules, func(m *schema.Module) bool { return m.Name == event.Module.Name }) event.schema = clone e.view.Store(clone) e.events <- event @@ -198,7 +194,6 @@ func New(ctx context.Context, client ftlv1connect.SchemaServiceClient) EventSour event := EventRemove{ Deployment: someDeploymentKey, Module: sch, - Deleted: resp.ModuleRemoved, more: more, } out.Publish(event) diff --git a/internal/schema/schemaeventsource/schemaeventsource_test.go b/internal/schema/schemaeventsource/schemaeventsource_test.go index aeba248ad..e153ebab7 100644 --- a/internal/schema/schemaeventsource/schemaeventsource_test.go +++ b/internal/schema/schemaeventsource/schemaeventsource_test.go @@ -170,7 +170,7 @@ func TestSchemaEventSource(t *testing.T) { ChangeType: ftlv1.DeploymentChangeType_DEPLOYMENT_CHANGE_TYPE_REMOVED, ModuleRemoved: true, }) - var expected Event = EventRemove{Module: echo1, Deleted: true} + var expected Event = EventRemove{Module: echo1} actual := recv(t) assertEqual(t, expected, actual) assertEqual(t, &schema.Schema{Modules: []*schema.Module{time2}}, changes.View())