@@ -46,7 +46,7 @@ var defaultStreamConfig = p2ptypes.StreamConfig{
4646
4747type launcher struct {
4848 services.StateMachine
49- lggr logger.Logger
49+ lggr logger.SugaredLogger
5050 myPeerID p2ptypes.PeerID
5151 peerWrapper p2ptypes.PeerWrapper
5252 dispatcher remotetypes.Dispatcher
@@ -106,7 +106,7 @@ func NewLauncher(
106106 return nil , fmt .Errorf ("failed to create launcher metrics: %w" , err )
107107 }
108108 return & launcher {
109- lggr : logger .Named (lggr , "CapabilitiesLauncher" ),
109+ lggr : logger .Sugared (lggr ). Named ( "CapabilitiesLauncher" ),
110110 peerWrapper : peerWrapper ,
111111 dispatcher : dispatcher ,
112112 cachedShims : cachedShims {
@@ -342,9 +342,12 @@ func (w *launcher) OnNewRegistry(ctx context.Context, localRegistry *registrysyn
342342 for family := range myDONFamiliesSet {
343343 myDONFamilies = append (myDONFamilies , family )
344344 }
345- w .lggr .Debugw ("Found my DON families" , "count" , len (myDONFamilies ), "myDONFamilies" , myDONFamilies )
346- w .lggr .Debugw ("Found my workflow DONs" , "count" , len (myWorkflowDONs ), "myWorkflowDONs" , myWorkflowDONs )
347- w .lggr .Debugw ("Found all remote workflow DONs" , "count" , len (remoteWorkflowDONs ), "remoteWorkflowDONs" , remoteWorkflowDONs )
345+ w .lggr .Debugw ("Found my DON families" , "count" , len (myDONFamilies ))
346+ w .lggr .Tracew ("My DON families" , "myDONFamilies" , myDONFamilies )
347+ w .lggr .Debugw ("Found my workflow DONs" , "count" , len (myWorkflowDONs ))
348+ w .lggr .Tracew ("My workflow DONs" , "myWorkflowDONs" , myWorkflowDONs )
349+ w .lggr .Debugw ("Found all remote workflow DONs" , "count" , len (remoteWorkflowDONs ))
350+ w .lggr .Tracew ("All remote workflow DONs" , "remoteWorkflowDONs" , remoteWorkflowDONs )
348351
349352 // Capability DONs (with IsPublic = true) the current node is a part of.
350353 // These need server-side shims to expose my own capabilities externally.
@@ -359,14 +362,18 @@ func (w *launcher) OnNewRegistry(ctx context.Context, localRegistry *registrysyn
359362 }
360363 }
361364 }
362- w .lggr .Debugw ("Found my capability DONs" , "count" , len (myCapabilityDONs ), "myCapabilityDONs" , myCapabilityDONs )
363- w .lggr .Debugw ("Found all remote capability DONs" , "count" , len (remoteCapabilityDONs ), "remoteCapabilityDONs" , remoteCapabilityDONs )
365+ w .lggr .Debugw ("Found my capability DONs" , "count" , len (myCapabilityDONs ))
366+ w .lggr .Tracew ("My capability DONs" , "myCapabilityDONs" , myCapabilityDONs )
367+ w .lggr .Debugw ("Found all remote capability DONs" , "count" , len (remoteCapabilityDONs ))
368+ w .lggr .Tracew ("All remote capability DONs" , "remoteCapabilityDONs" , remoteCapabilityDONs )
364369
365370 if len (myDONFamilies ) > 0 {
366371 remoteWorkflowDONs = filterDONsByFamilies (remoteWorkflowDONs , myDONFamilies )
367372 remoteCapabilityDONs = filterDONsByFamilies (remoteCapabilityDONs , myDONFamilies )
368- w .lggr .Debugw ("Filtered remote workflow DONs to my families" , "count" , len (remoteWorkflowDONs ), "remoteWorkflowDONs" , remoteWorkflowDONs )
369- w .lggr .Debugw ("Filtered remote capability DONs to my families" , "count" , len (remoteCapabilityDONs ), "remoteCapabilityDONs" , remoteCapabilityDONs )
373+ w .lggr .Debugw ("Filtered remote workflow DONs to my families" , "count" , len (remoteWorkflowDONs ))
374+ w .lggr .Tracew ("Filtered remote workflow DONs to my families" , "remoteWorkflowDONs" , remoteWorkflowDONs )
375+ w .lggr .Debugw ("Filtered remote capability DONs to my families" , "count" , len (remoteCapabilityDONs ))
376+ w .lggr .Tracew ("Filtered remote capability DONs to my families" , "remoteCapabilityDONs" , remoteCapabilityDONs )
370377 } else {
371378 // legacy / Keystone setting
372379 w .lggr .Debug ("My node doesn't belong to any DON families. No filtering will be applied." )
@@ -401,23 +408,8 @@ func (w *launcher) OnNewRegistry(ctx context.Context, localRegistry *registrysyn
401408
402409 belongsToACapabilityDON := len (myCapabilityDONs ) > 0
403410 if belongsToACapabilityDON {
404- // Include both remote workflow DONs and the node's own workflow DONs.
405- // In single-DON topologies (e.g. local CRE), the same DON is both a
406- // workflow DON and a capability DON, so remoteWorkflowDONs is empty.
407- // Without including myWorkflowDONs, capabilities fail to serve with
408- // "empty workflowDONs provided".
409- allWorkflowDONs := make ([]registrysyncer.DON , 0 , len (remoteWorkflowDONs )+ len (myWorkflowDONs ))
410- allWorkflowDONs = append (allWorkflowDONs , remoteWorkflowDONs ... )
411- allWorkflowDONs = append (allWorkflowDONs , myWorkflowDONs ... )
412411 for _ , myDON := range myCapabilityDONs {
413- w .serveCapabilities (ctx , w .myPeerID , myDON , localRegistry , allWorkflowDONs )
414-
415- // Capability DONs also need remote capabilities (e.g. relay DON
416- // needs vault for secret fetching). Without this, only workflow
417- // DONs discover cross-DON capabilities.
418- for _ , rcd := range remoteCapabilityDONs {
419- w .addRemoteCapabilities (ctx , myDON , rcd , localRegistry )
420- }
412+ w .serveCapabilities (ctx , w .myPeerID , myDON , localRegistry , remoteWorkflowDONs )
421413 }
422414 }
423415
@@ -433,7 +425,7 @@ func (w *launcher) OnNewRegistry(ctx context.Context, localRegistry *registrysyn
433425 }
434426 if w .don2donSharedPeer != nil {
435427 donPairs := w .donPairsToUpdate (w .myPeerID , localRegistry )
436- err := w .don2donSharedPeer .UpdateConnectionsByDONs (ctx , donPairs , defaultStreamConfig )
428+ err := w .don2donSharedPeer .UpdateConnectionsByDONs (ctx , donPairs , w . p2pStreamConfig )
437429 if err != nil {
438430 return fmt .Errorf ("failed to update peer connections: %w" , err )
439431 }
0 commit comments