1
0
mirror of https://github.com/FloatTech/zbpdata.git synced 2026-02-16 04:05:54 +09:00

Compare commits

..

5 Commits

Author SHA1 Message Date
源文雨
50b189ebad feat: 改为并行上传 2022-04-17 16:10:37 +08:00
源文雨
ab10aa8a6b feat: 改为并行上传 2022-04-17 16:03:41 +08:00
himawari
3b9009e90f 添加停用词 (#16) 2022-04-16 20:03:36 +08:00
Kanri
7d6739a9b7 增加运势 奇异恩典 2022-04-03 14:31:18 +08:00
源文雨
5155c7318a 🙈 edit ignore 2022-03-28 16:12:34 +08:00
4 changed files with 1917 additions and 7 deletions

3
.gitignore vendored
View File

@@ -18,4 +18,5 @@ scale
.vscode
MockingBird/cache
driftbottle
job
job
hyaku

BIN
Fortune/奇异恩典.zip Normal file

Binary file not shown.

1893
WordCount/stopwords.txt Normal file

File diff suppressed because it is too large Load Diff

28
main.go
View File

@@ -10,9 +10,11 @@ import (
"io/fs"
"os"
"strings"
"sync"
"unicode"
"unsafe"
"github.com/FloatTech/zbputils/process"
"github.com/fumiama/go-registry"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
)
@@ -44,12 +46,26 @@ func main() {
if err != nil {
panic(err)
}
defer r.Close()
var wg sync.WaitGroup
wg.Add(len(files))
for i, fn := range files {
fmt.Println("set", "data/"+fn, "=", hex.EncodeToString(helper.StringToBytes(md5s[i])))
err = r.Set("data/"+fn, md5s[i])
if err != nil {
panic(err)
}
go func(i int, fn string) {
defer wg.Done()
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)
}
r.Close()
wg.Wait()
}