This commit is contained in:
geek 2018-07-03 14:29:26 +09:00
parent ebe9ac6fd2
commit 5ef5f62fcb

View File

@ -126,13 +126,13 @@ func (s *SensorConfigService) UpdateConfig(tempFilePath string) error {
return err
}
//delete(s.sensorConfigs, sc.ConfigID)
//s.sensorConfigs[sc.ID.String()] = sc
//s.sortSensorConfigPerContainer()
//
//if err := s.ContainerService.Send(occp.ToContainerType(sc.Crawler.Container), "SensorConfigService.UpdateConfig", sc); nil != err {
// return err
//}
delete(s.sensorConfigs, sc.SensorID.String())
s.sensorConfigs[sc.SensorID.String()] = sc
s.sortSensorConfigPerContainer()
if err := s.ContainerService.Send(occp.ToContainerType(sc.Crawler.MetaCrawlerContainerKey), "SensorConfigService.UpdateConfig", sc); nil != err {
return err
}
return nil
}
@ -152,9 +152,9 @@ func (s *SensorConfigService) RemoveConfig(sensorConfigID string) error {
delete(s.sensorConfigs, sensorConfigID)
s.sortSensorConfigPerContainer()
//if err := s.ContainerService.Send(occp.ToContainerType(sc.Crawler.Container), "SensorConfigService.RemoveConfig", sensorConfigID); nil != err {
// return err
//}
if err := s.ContainerService.Send(occp.ToContainerType(sc.Crawler.MetaCrawlerContainerKey), "SensorConfigService.RemoveConfig", sensorConfigID); nil != err {
return err
}
return nil
}
@ -283,8 +283,8 @@ func (s *SensorConfigService) sortSensorConfigPerContainer() {
s.sensorConfigsPerContainer = nil
s.sensorConfigsPerContainer = make(map[occp.ContainerType][]*ocmsc.SensorConfig)
//for _, sensorConfig := range s.sensorConfigs {
// containerType := occp.ToContainerType(sensorConfig.Crawler.Container)
// s.sensorConfigsPerContainer[containerType] = append(s.sensorConfigsPerContainer[containerType], sensorConfig)
//}
for _, sensorConfig := range s.sensorConfigs {
containerType := occp.ToContainerType(sensorConfig.Crawler.MetaCrawlerContainerKey)
s.sensorConfigsPerContainer[containerType] = append(s.sensorConfigsPerContainer[containerType], sensorConfig)
}
}