@@ -364,13 +364,14 @@ func (s *Session) sender() {
364364 }
365365 logger .Println ("The update operation has been performed on user" )
366366 default :
367- panic ("unhandled default case" )
367+ err := fmt .Errorf ("session received unexpected user watch event action: %s" , watchEvent .Action .String ())
368+ logger .WithError (err ).Error ("user update handling error" )
369+ continue
368370 }
369371
370372 if watchEvent .User == nil {
371373 logger .Error ("session received nil user in watch event" )
372374 }
373- //
374375 lagger := logger .WithFields (logrus.Fields {
375376 "action" : watchEvent .Action .String (),
376377 "user" : watchEvent .User .Username ,
@@ -543,7 +544,6 @@ func (s *Session) Start() (err error) {
543544 agentName := agentUUID (s .cfg .Namespace , s .cfg .AgentName )
544545
545546 // Subscribe the agent to its user_config topic
546-
547547 userTopic := messaging .UserConfigTopic (s .cfg .User )
548548 logger .WithField ("topic" , userTopic ).Debug ("subscribing to topic" )
549549 userSubscription , usrErr := s .bus .Subscribe (userTopic , agentName , s .userConfig )
@@ -565,7 +565,6 @@ func (s *Session) Start() (err error) {
565565 }
566566
567567 // Subscribe the agent to its entity_config topic
568-
569568 topic := messaging .EntityConfigTopic (s .cfg .Namespace , s .cfg .AgentName )
570569 lager .WithField ("topic" , topic ).Debug ("subscribing to topic" )
571570
@@ -575,6 +574,8 @@ func (s *Session) Start() (err error) {
575574 lager .WithError (err ).Error ("error starting subscription" )
576575 return err
577576 }
577+
578+ // Determine if the entity already exists
578579 s .entityConfig .subscriptions <- subscription
579580 req := storev2 .NewResourceRequest (s .ctx , s .cfg .Namespace , s .cfg .AgentName , (& corev3.EntityConfig {}).StoreName ())
580581 wrapper , err := s .storev2 .Get (req )
0 commit comments