mirror of
https://github.com/FloatTech/zbpdata.git
synced 2026-02-17 04:27:58 +09:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3d25c45fd | ||
|
|
6d4212b19d | ||
|
|
e48e615305 | ||
|
|
365b1a915a | ||
|
|
7aa2cbd0f5 | ||
|
|
fb80a176f0 | ||
|
|
50b189ebad | ||
|
|
ab10aa8a6b |
24
main.go
24
main.go
@@ -10,9 +10,11 @@ import (
|
|||||||
"io/fs"
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
"unicode"
|
"unicode"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
|
"github.com/FloatTech/zbputils/process"
|
||||||
"github.com/fumiama/go-registry"
|
"github.com/fumiama/go-registry"
|
||||||
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
||||||
)
|
)
|
||||||
@@ -44,12 +46,26 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
defer r.Close()
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
wg.Add(len(files))
|
||||||
for i, fn := range files {
|
for i, fn := range files {
|
||||||
fmt.Println("set", "data/"+fn, "=", hex.EncodeToString(helper.StringToBytes(md5s[i])))
|
go func(i int, fn string) {
|
||||||
|
defer wg.Done()
|
||||||
|
for c := 0; c < 5; c++ {
|
||||||
err = r.Set("data/"+fn, md5s[i])
|
err = r.Set("data/"+fn, md5s[i])
|
||||||
if err != nil {
|
fmt.Println("set", "data/"+fn, "=", hex.EncodeToString(helper.StringToBytes(md5s[i])))
|
||||||
panic(err)
|
if err == nil {
|
||||||
|
break
|
||||||
}
|
}
|
||||||
|
if c >= 4 {
|
||||||
|
panic("ERROR:" + err.Error() + "max retry times exceeded")
|
||||||
|
} else {
|
||||||
|
fmt.Println("ERROR:", err, ", retry times:", c)
|
||||||
}
|
}
|
||||||
r.Close()
|
process.SleepAbout1sTo2s()
|
||||||
|
}
|
||||||
|
}(i, fn)
|
||||||
|
}
|
||||||
|
wg.Wait()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user