fix mod for shops slaves workload

This commit is contained in:
shoopea 2020-02-13 16:50:41 +08:00
parent 3fa7fbdf84
commit 469c2975bc
2 changed files with 2 additions and 20 deletions

15
bot.go
View File

@ -80,17 +80,6 @@ func botDocument(m *tb.Message) {
// documents only
}
func botHello(m *tb.Message) (string, error) {
fmt.Println("botHello :", m.Text)
if !m.Private() {
fmt.Println("botHello : !m.Private()")
return ``, nil
}
// fmt.Println("Hello payload :", m.Payload) // <PAYLOAD>
PrintText(m)
return `hello world`, nil
}
func botChannelPost(m *tb.Message) {
PrintText(m)
b, _ := json.Marshal(m)
@ -776,7 +765,7 @@ func botShops(m *ChatWarsMessage) {
// fan out to all active and non idle clients
clts, err := getAllIdleClientID64()
if err != nil {
if err != nil || len(clts) == 0 {
c := TGCommand{
Type: commandReplyMsg,
Text: "Busy, please retry later.",
@ -805,7 +794,7 @@ func botShops(m *ChatWarsMessage) {
Shops: make([]string, 0),
}
for j, s := range cfg.Bot.Shops {
if (j / len(clts)) == i {
if (j % len(clts)) == i {
j2.Shops = append(j2.Shops, s.Link)
}
}

View File

@ -64,13 +64,6 @@ func main() {
err := ReadConfig(*config)
failOnError(err, "Parsing config")
_, err = Asset("data/code_obj_type.json")
failOnError(err, "data/code_obj_type.json")
_, err = Asset("data/code_obj_type.json")
failOnError(err, "data/code_obj_sub_type.json")
_, err = Asset("data/code_obj_type.json")
failOnError(err, "data/msg_rules.json")
// Connecting to DB
switch cfg.SQL.Driver {
case "mysql":