Skip to content

Commit

Permalink
chore: remove event field that is always true
Browse files Browse the repository at this point in the history
  • Loading branch information
jvmakine committed Jan 7, 2025
1 parent 37542a5 commit abc08c6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions internal/schema/schemaeventsource/schemaeventsource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit abc08c6

Please sign in to comment.