mirror of
https://github.com/FloatTech/zbpdata.git
synced 2024-11-17 09:37:14 +09:00
fix: push
This commit is contained in:
parent
6df0a6f70b
commit
f2fa48b3d7
38
main.go
38
main.go
@ -10,11 +10,9 @@ 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"
|
||||||
)
|
)
|
||||||
@ -46,26 +44,24 @@ 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 {
|
||||||
go func(i int, fn string) {
|
for c := 0; c < 5; c++ {
|
||||||
defer wg.Done()
|
err = r.Set("data/"+fn, md5s[i])
|
||||||
for c := 0; c < 5; c++ {
|
fmt.Println("set", "data/"+fn, "=", hex.EncodeToString(helper.StringToBytes(md5s[i])))
|
||||||
err = r.Set("data/"+fn, md5s[i])
|
if err == nil {
|
||||||
fmt.Println("set", "data/"+fn, "=", hex.EncodeToString(helper.StringToBytes(md5s[i])))
|
break
|
||||||
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)
|
if c >= 4 {
|
||||||
|
panic("ERROR:" + err.Error() + "max retry times exceeded")
|
||||||
|
} else {
|
||||||
|
fmt.Println("ERROR:", err, ", retry times:", c)
|
||||||
|
}
|
||||||
|
_ = r.Close()
|
||||||
|
err = r.Connect()
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
wg.Wait()
|
_ = r.Close()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user