Skip to content

Commit

Permalink
[ws-manager-mk2] filter out lastActivity
Browse files Browse the repository at this point in the history
  • Loading branch information
kylos101 committed Mar 19, 2024
1 parent d190ee4 commit 3a4ac50
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion components/ws-daemon/pkg/controller/workspace_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
"github.com/gitpod-io/gitpod/ws-daemon/pkg/content"
"github.com/gitpod-io/gitpod/ws-daemon/pkg/iws"
workspacev1 "github.com/gitpod-io/gitpod/ws-manager/api/crd/v1"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/opentracing/opentracing-go"
"github.com/prometheus/client_golang/prometheus"

Expand Down Expand Up @@ -97,7 +99,11 @@ func eventFilter(nodeName string) predicate.Predicate {
},

UpdateFunc: func(e event.UpdateEvent) bool {
return workspaceFilter(e.ObjectNew, nodeName)
old := e.ObjectOld.(*workspacev1.Workspace)
new := e.ObjectNew.(*workspacev1.Workspace)
hasChanged := !cmp.Equal(old.Status, new.Status, cmpopts.IgnoreFields(workspacev1.WorkspaceStatus{}, "LastActivity"))

return hasChanged && workspaceFilter(e.ObjectNew, nodeName)
},
DeleteFunc: func(e event.DeleteEvent) bool {
return false
Expand Down

0 comments on commit 3a4ac50

Please sign in to comment.