@@ -71,11 +71,9 @@ type EndpointSliceConfig struct {
71
71
72
72
// NewEndpointSliceConfig creates a new EndpointSliceConfig.
73
73
func NewEndpointSliceConfig (endpointSliceInformer discoveryinformers.EndpointSliceInformer , resyncPeriod time.Duration ) * EndpointSliceConfig {
74
- result := & EndpointSliceConfig {
75
- listerSynced : endpointSliceInformer .Informer ().HasSynced ,
76
- }
74
+ result := & EndpointSliceConfig {}
77
75
78
- endpointSliceInformer .Informer ().AddEventHandlerWithResyncPeriod (
76
+ handlerRegistration , _ := endpointSliceInformer .Informer ().AddEventHandlerWithResyncPeriod (
79
77
cache.ResourceEventHandlerFuncs {
80
78
AddFunc : result .handleAddEndpointSlice ,
81
79
UpdateFunc : result .handleUpdateEndpointSlice ,
@@ -84,6 +82,8 @@ func NewEndpointSliceConfig(endpointSliceInformer discoveryinformers.EndpointSli
84
82
resyncPeriod ,
85
83
)
86
84
85
+ result .listerSynced = handlerRegistration .HasSynced
86
+
87
87
return result
88
88
}
89
89
@@ -162,11 +162,9 @@ type ServiceConfig struct {
162
162
163
163
// NewServiceConfig creates a new ServiceConfig.
164
164
func NewServiceConfig (serviceInformer coreinformers.ServiceInformer , resyncPeriod time.Duration ) * ServiceConfig {
165
- result := & ServiceConfig {
166
- listerSynced : serviceInformer .Informer ().HasSynced ,
167
- }
165
+ result := & ServiceConfig {}
168
166
169
- serviceInformer .Informer ().AddEventHandlerWithResyncPeriod (
167
+ handlerRegistration , _ := serviceInformer .Informer ().AddEventHandlerWithResyncPeriod (
170
168
cache.ResourceEventHandlerFuncs {
171
169
AddFunc : result .handleAddService ,
172
170
UpdateFunc : result .handleUpdateService ,
@@ -175,6 +173,8 @@ func NewServiceConfig(serviceInformer coreinformers.ServiceInformer, resyncPerio
175
173
resyncPeriod ,
176
174
)
177
175
176
+ result .listerSynced = handlerRegistration .HasSynced
177
+
178
178
return result
179
179
}
180
180
0 commit comments