@@ -92,25 +92,20 @@ func (s *MessageQueueEventServer) Start(ctx context.Context) {
9292// startSubscription initiates the subscription to resource status update messages.
9393// It runs asynchronously in the background until the provided context is canceled.
9494func (s * MessageQueueEventServer ) startSubscription (ctx context.Context ) {
95- s .sourceClient .Subscribe (ctx , func (subCtx context.Context , action types. ResourceAction , resource * api.Resource ) error {
96- logger := klog .FromContext (subCtx ).WithValues ("resourceID" , resource .ID , "action" , action )
97- logger .Info ("received action for resource" )
95+ s .sourceClient .Subscribe (ctx , func (subCtx context.Context , resource * api.Resource ) error {
96+ logger := klog .FromContext (subCtx ).WithValues ("resourceID" , resource .ID )
97+ logger .Info ("received status update for resource" )
9898 subCtx = klog .NewContext (subCtx , logger )
9999
100- switch action {
101- case types .StatusModified :
102- if ! s .statusDispatcher .Dispatch (resource .ConsumerName ) {
103- // the resource is not owned by the current instance, skip
104- logger .Info ("skipping resource status update as it is not owned by the current instance" )
105- return nil
106- }
100+ if ! s .statusDispatcher .Dispatch (resource .ConsumerName ) {
101+ // the resource is not owned by the current instance, skip
102+ logger .Info ("skipping resource status update as it is not owned by the current instance" )
103+ return nil
104+ }
107105
108- // handle the resource status update according status update type
109- if err := handleStatusUpdate (subCtx , resource , s .resourceService , s .statusEventService ); err != nil {
110- return fmt .Errorf ("failed to handle resource status update %s: %s" , resource .ID , err .Error ())
111- }
112- default :
113- return fmt .Errorf ("failed to handle resource status update %s: unsupported action %s" , resource .ID , action )
106+ // handle the resource status update according status update type
107+ if err := handleStatusUpdate (subCtx , resource , s .resourceService , s .statusEventService ); err != nil {
108+ return fmt .Errorf ("failed to handle resource status update %s: %s" , resource .ID , err .Error ())
114109 }
115110
116111 return nil
0 commit comments