快速执行, 跳过错误的行
This commit is contained in:
		@@ -110,13 +110,18 @@ func NewSchema(config Config) (graphql.Schema, error) {
 | 
			
		||||
 | 
			
		||||
	// 定时检查补全颜色字段
 | 
			
		||||
	checkColorNullRows := func() {
 | 
			
		||||
		// 跳过的行数
 | 
			
		||||
		offset := 0
 | 
			
		||||
 | 
			
		||||
		for {
 | 
			
		||||
			time.Sleep(10 * time.Second)
 | 
			
		||||
			time.Sleep(1 * time.Second)
 | 
			
		||||
			var list []struct {
 | 
			
		||||
				ID      int
 | 
			
		||||
				Content string
 | 
			
		||||
			}
 | 
			
		||||
			if err := db.Table("web_images").Select("id", "content").Where("article_category_top_id = 22").Where("color_0_r IS NULL").Limit(10).Scan(&list).Error; err != nil {
 | 
			
		||||
 | 
			
		||||
			fmt.Println("跳过的行数:", offset)
 | 
			
		||||
			if err := db.Table("web_images").Select("id", "content").Where("article_category_top_id = 22").Where("color_0_r IS NULL").Offset(offset).Limit(100).Scan(&list).Error; err != nil {
 | 
			
		||||
				fmt.Println("定时检查补全颜色字段查询失败", err)
 | 
			
		||||
				continue
 | 
			
		||||
			}
 | 
			
		||||
@@ -131,6 +136,7 @@ func NewSchema(config Config) (graphql.Schema, error) {
 | 
			
		||||
				file, err := os.Open(filepath)
 | 
			
		||||
				if err != nil {
 | 
			
		||||
					fmt.Println("打开文件失败", index, item.ID, item.Content, err)
 | 
			
		||||
					offset++
 | 
			
		||||
					continue
 | 
			
		||||
				}
 | 
			
		||||
				defer file.Close()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user