SophieTech88 commented on code in PR #850:
URL: https://github.com/apache/yunikorn-k8shim/pull/850#discussion_r1623136235
##########
pkg/client/apifactory.go:
##########
@@ -166,34 +167,42 @@ func (s *APIFactory) AddEventHandler(handlers
*ResourceEventHandlers) {
}
log.Log(log.ShimClient).Info("registering event handler",
zap.Stringer("type", handlers.Type))
- s.addEventHandlers(handlers.Type, h, 0)
+ if err := s.addEventHandlers(handlers.Type, h, 0); err != nil {
+ log.Log(log.AdmissionConf).Fatal("Failed to initialize event
handlers", zap.Error(err))
Review Comment:
Good catch. Appreciated. Earlier I only return the error for
`addEventHandlers`, but forgot to check `AddEventHandler`, when there is error
returned, it should not exit in the middle.
I check the `AddEventHandler`, it is called by 3 functionss:
RegisterHandlers, NewPriorityClassCache, NewNamespaceCache in main. When the
AddEventHandler pass the error back, those 3 functions will return errors, too,
and we can make the decision how to deal with the errors in main(). So it is
great.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]