This commit is contained in:
shoopea 2019-06-03 09:40:37 +08:00
parent 8bf6e0b7ab
commit 3a45e3f595
3 changed files with 14 additions and 11 deletions

View File

@ -5,7 +5,7 @@ import (
)
func reloadObjItem(code string, name string, itemTypeID64 int64, weight int) {
id := getObjItemID(code, name)
id := silentGetObjItemID(code, name)
if id == 0 {
_, err := addObjItem(code, name, itemTypeID64, weight)
logOnError(err, "reloadObjItem : addObjItem")

21
obj.go
View File

@ -500,18 +500,23 @@ func addObjItem(code string, name string, itemTypeID64 int64, weight int) (int64
}
func getObjItemID(c string, n string) int64 {
i := silentGetObjItemID(c, n)
if i == 0 {
w := TGCommand{
Type: commandSendMsg,
Text: fmt.Sprintf("Object unknown : %s - %s\n", c, n),
ToUserID64: cfg.Bot.Admin,
}
TGCmdQueue <- w
}
return i
}
func silentGetObjItemID(c string, n string) int64 {
if v, ok := cacheObjItem.Load(c); ok {
i := v.(ChatWarsItem)
return i.ObjID64
} else {
/*
w := TGCommand{
Type: commandSendMsg,
Text: fmt.Sprintf("Object unknown : %s - %s\n", c, n),
ToUserID64: cfg.Bot.Admin,
}
TGCmdQueue <- w
*/
return 0
}
}

View File

@ -220,8 +220,6 @@ func SQLJobWorker() {
}
if len(jobs) < SQLJobSliceSize {
time.Sleep(100 * time.Millisecond)
} else {
time.Sleep(1 * time.Millisecond)
}
}
log.Printf("SQLJobWorker : Closing.")