mirror of
				https://github.com/FloatTech/zbpdata.git
				synced 2025-10-31 19:00:51 +09:00 
			
		
		
		
	feat: 改为并行上传
This commit is contained in:
		
							parent
							
								
									ab10aa8a6b
								
							
						
					
					
						commit
						50b189ebad
					
				
							
								
								
									
										17
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								main.go
									
									
									
									
									
								
							| @ -14,6 +14,7 @@ import ( | ||||
| 	"unicode" | ||||
| 	"unsafe" | ||||
| 
 | ||||
| 	"github.com/FloatTech/zbputils/process" | ||||
| 	"github.com/fumiama/go-registry" | ||||
| 	"github.com/wdvxdr1123/ZeroBot/utils/helper" | ||||
| ) | ||||
| @ -51,10 +52,18 @@ func main() { | ||||
| 	for i, fn := range files { | ||||
| 		go func(i int, fn string) { | ||||
| 			defer wg.Done() | ||||
| 			err = r.Set("data/"+fn, md5s[i]) | ||||
| 			fmt.Println("set", "data/"+fn, "=", hex.EncodeToString(helper.StringToBytes(md5s[i]))) | ||||
| 			if err != nil { | ||||
| 				panic(err) | ||||
| 			for c := 0; c < 5; c++ { | ||||
| 				err = r.Set("data/"+fn, md5s[i]) | ||||
| 				fmt.Println("set", "data/"+fn, "=", hex.EncodeToString(helper.StringToBytes(md5s[i]))) | ||||
| 				if err == nil { | ||||
| 					break | ||||
| 				} | ||||
| 				if c >= 4 { | ||||
| 					panic("ERROR:" + err.Error() + "max retry times exceeded") | ||||
| 				} else { | ||||
| 					fmt.Println("ERROR:", err, ", retry times:", c) | ||||
| 				} | ||||
| 				process.SleepAbout1sTo2s() | ||||
| 			} | ||||
| 		}(i, fn) | ||||
| 	} | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user