@@ -327,35 +327,30 @@ func (s *npCollectorImpl) scheduleNetworkPathTests(origin payload.PathOrigin, co
327327 }
328328 pathtest := s .makePathtest (conn , origin )
329329 if baseline {
330- pathtest .DynamicTestProfile = payload .DynamicTestProfileBaseline
331- selected = addBaselineCandidate (selected , baselineCandidate {
332- path : pathtest ,
333- pathHash : pathtest .GetHash (),
334- diagnostic : conn .Baseline .Diagnostic ,
335- bytes : conn .Baseline .Bytes ,
336- })
330+ selected = addBaselinePath (selected , pathtest , conn .Baseline )
337331 continue
338332 }
339333
340- pathtest .TestConfigID = evaluation .testConfigID
341- pathtest .Tags = evaluation .tags
342- if evaluation .testConfigID != "" {
343- pathtest .TestConfigSource = payload .TestConfigSourceRemote
344- }
345- err := s .scheduleOne (& pathtest )
346- if err != nil {
334+ if err := s .scheduleNetworkPathTest (pathtest , evaluation ); err != nil {
347335 s .logger .Errorf ("Error scheduling pathtests: %s" , err )
348336 }
349337 }
350- for i := range selected {
351- if err := s .scheduleOne (& selected [i ].path ); err != nil {
352- s .logger .Errorf ("Error scheduling baseline pathtest: %s" , err )
353- }
338+ if baseline {
339+ s .scheduleBaselinePaths (selected )
354340 }
355341 _ = s .statsdClient .Count (common .NetworkPathCollectorMetricPrefix + "schedule.conns_received" , int64 (connCount ), []string {}, 1 )
356342 _ = s .statsdClient .Gauge (common .NetworkPathCollectorMetricPrefix + "schedule.duration" , s .TimeNowFn ().Sub (startTime ).Seconds (), nil , 1 )
357343}
358344
345+ func (s * npCollectorImpl ) scheduleNetworkPathTest (pathtest common.Pathtest , evaluation pathEvaluation ) error {
346+ pathtest .TestConfigID = evaluation .testConfigID
347+ pathtest .Tags = evaluation .tags
348+ if evaluation .testConfigID != "" {
349+ pathtest .TestConfigSource = payload .TestConfigSourceRemote
350+ }
351+ return s .scheduleOne (& pathtest )
352+ }
353+
359354// scheduleOne schedules pathtests.
360355// It shouldn't block, if the input channel is full, an error is returned.
361356func (s * npCollectorImpl ) scheduleOne (pathtest * common.Pathtest ) error {
0 commit comments