@@ -84,10 +84,14 @@ func newSwarmListener(
8484 ssListener SwarmServiceListening ,
8585 ssClient SwarmServiceInspector ,
8686 ssCache SwarmServiceCacher ,
87+ ssEventChan chan Event ,
88+ ssNotificationChan chan Notification ,
8789
8890 nodeListener NodeListening ,
8991 nodeClient NodeInspector ,
9092 nodeCache NodeCacher ,
93+ nodeEventChan chan Event ,
94+ nodeNotificationChan chan Notification ,
9195
9296 notifyDistributor NotifyDistributing ,
9397
@@ -105,13 +109,13 @@ func newSwarmListener(
105109 SSListener : ssListener ,
106110 SSClient : ssClient ,
107111 SSCache : ssCache ,
108- SSEventChan : make ( chan Event ) ,
109- SSNotificationChan : make ( chan Notification ) ,
112+ SSEventChan : ssEventChan ,
113+ SSNotificationChan : ssNotificationChan ,
110114 NodeListener : nodeListener ,
111115 NodeClient : nodeClient ,
112116 NodeCache : nodeCache ,
113- NodeEventChan : make ( chan Event ) ,
114- NodeNotificationChan : make ( chan Notification ) ,
117+ NodeEventChan : nodeEventChan ,
118+ NodeNotificationChan : nodeNotificationChan ,
115119 NotifyDistributor : notifyDistributor ,
116120 ServiceCreateRemoveCancelManager : & CreateRemoveCancelManager {
117121 createCancelManager : serviceCreateCancelManager ,
@@ -140,29 +144,42 @@ func NewSwarmListenerFromEnv(retries, interval int, logger *log.Logger) (*SwarmL
140144 var ssListener * SwarmServiceListener
141145 var ssClient * SwarmServiceClient
142146 var ssCache * SwarmServiceCache
147+ var ssEventChan chan Event
148+ var ssNotificationChan chan Notification
149+
143150 var nodeListener * NodeListener
144151 var nodeClient * NodeClient
145152 var nodeCache * NodeCache
153+ var nodeEventChan chan Event
154+ var nodeNotificationChan chan Notification
146155
147156 if notifyDistributor .HasServiceListeners () {
148157 ssListener = NewSwarmServiceListener (dockerClient , logger )
149158 ssClient = NewSwarmServiceClient (dockerClient , ignoreKey , "com.df.scrapeNetwork" , logger )
150159 ssCache = NewSwarmServiceCache ()
160+ ssEventChan = make (chan Event )
161+ ssNotificationChan = make (chan Notification )
151162 }
152163
153164 if notifyDistributor .HasNodeListeners () {
154165 nodeListener = NewNodeListener (dockerClient , logger )
155166 nodeClient = NewNodeClient (dockerClient )
156167 nodeCache = NewNodeCache ()
168+ nodeEventChan = make (chan Event )
169+ nodeNotificationChan = make (chan Notification )
157170 }
158171
159172 return newSwarmListener (
160173 ssListener ,
161174 ssClient ,
162175 ssCache ,
176+ ssEventChan ,
177+ ssNotificationChan ,
163178 nodeListener ,
164179 nodeClient ,
165180 nodeCache ,
181+ nodeEventChan ,
182+ nodeNotificationChan ,
166183 notifyDistributor ,
167184 NewCancelManager (false ),
168185 NewCancelManager (false ),
0 commit comments