[FIX] clean manager does not work

This commit is contained in:
GLYASAI 2019-06-20 17:01:26 +08:00
parent 21a0a6f456
commit 9af4d32594
2 changed files with 3 additions and 2 deletions

View File

@ -78,7 +78,7 @@ func (a *Builder) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&a.RunMode, "run", "sync", "sync data when worker start")
fs.StringVar(&a.DockerEndpoint, "dockerd", "127.0.0.1:2376", "dockerd endpoint")
fs.StringVar(&a.HostIP, "hostIP", "", "Current node Intranet IP")
fs.BoolVar(&a.CleanUp, "clean-up", false, "Turn on build version cleanup")
fs.BoolVar(&a.CleanUp, "clean-up", true, "Turn on build version cleanup")
fs.StringVar(&a.Topic, "topic", "builder", "Topic in mq,you coule choose `builder` or `windows_builder`")
}

View File

@ -144,7 +144,8 @@ func (c *VersionInfoDaoImpl) DeleteFailureVersionInfo(timePoint time.Time, statu
//SearchVersionInfo query version count >5
func (c *VersionInfoDaoImpl) SearchVersionInfo() ([]*model.VersionInfo, error) {
var result []*model.VersionInfo
if err := c.DB.Table("version_info").Select("service_id").Group("service_id").Having("count(ID) > ?", 5).Scan(&result).Error; err != nil {
versionInfo := &model.VersionInfo{}
if err := c.DB.Table(versionInfo.TableName()).Select("service_id").Group("service_id").Having("count(ID) > ?", 5).Scan(&result).Error; err != nil {
return nil, err
}
return result, nil