test
This commit is contained in:
parent
0431320a72
commit
29b583f664
2
job.go
2
job.go
@ -398,9 +398,7 @@ func jobRescan(j Job) {
|
||||
start := time.Now()
|
||||
milestone := time.Now()
|
||||
|
||||
log.Printf("jobRescan : getting message list")
|
||||
ids := getSQLListID64(p.Query)
|
||||
log.Printf("jobRescan : %d messages.", len(ids))
|
||||
|
||||
if len(ids) > 1 {
|
||||
m := TGCommand{
|
||||
|
12
sql.go
12
sql.go
@ -258,6 +258,7 @@ func initDB() {
|
||||
,item_id BIGINT UNSIGNED
|
||||
,cond VARCHAR(32)
|
||||
,quality VARCHAR(32)
|
||||
,mod VARCHAR(80)
|
||||
,seller_castle_id BIGINT UNSIGNED
|
||||
,seller_guild_id BIGINT UNSIGNED
|
||||
,seller_id BIGINT UNSIGNED
|
||||
@ -861,14 +862,14 @@ func insertMsgAuctionAnnounce(m *ChatWarsMessageAuctionAnnounce) error {
|
||||
return errors.New("Message type mismatch")
|
||||
}
|
||||
|
||||
stmt, err := db.Prepare(`INSERT INTO obj_msg_auction_announce (obj_id, lot_id, item_id, cond, quality, seller_id, seller_guild_id, seller_castle_id, buyer_id, buyer_guild_id, buyer_castle_id, price, status, end)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);`)
|
||||
stmt, err := db.Prepare(`INSERT INTO obj_msg_auction_announce (obj_id, lot_id, item_id, cond, quality, mod, seller_id, seller_guild_id, seller_castle_id, buyer_id, buyer_guild_id, buyer_castle_id, price, status, end)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);`)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer stmt.Close()
|
||||
|
||||
_, err = stmt.Exec(m.ObjID64, m.LotID, m.ItemID64, m.Cond, m.Quality, m.SellerUserID64, m.SellerGuildID64, m.SellerCastleID64, m.BuyerUserID64, m.BuyerGuildID64, m.BuyerCastleID64, m.Price, m.Status, m.End)
|
||||
_, err = stmt.Exec(m.ObjID64, m.LotID, m.ItemID64, m.Cond, m.Quality, m.Mod, m.SellerUserID64, m.SellerGuildID64, m.SellerCastleID64, m.BuyerUserID64, m.BuyerGuildID64, m.BuyerCastleID64, m.Price, m.Status, m.End)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -908,8 +909,6 @@ func getSQLListID64(q string) []int64 {
|
||||
count int64
|
||||
)
|
||||
|
||||
log.Printf("getSQLListID64 : starting")
|
||||
|
||||
rows, err := db.Query(q)
|
||||
logOnError(err, "getSQLListID64 : "+q)
|
||||
|
||||
@ -919,9 +918,6 @@ func getSQLListID64(q string) []int64 {
|
||||
err = rows.Scan(&id)
|
||||
logOnError(err, "getSQLListID64 : scan next val")
|
||||
ids = append(ids, id)
|
||||
if count%10000 == 0 {
|
||||
log.Printf("getSQLListID64 : %d entries", count)
|
||||
}
|
||||
}
|
||||
err = rows.Err()
|
||||
logOnError(err, "getSQLListID64 : query end")
|
||||
|
@ -617,7 +617,7 @@ func SQLJobWorker() {
|
||||
JobQueue <- j
|
||||
}
|
||||
if len(jobs) < SQLJobSliceSize {
|
||||
//time.Sleep(100 * time.Millisecond)
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
} else {
|
||||
time.Sleep(1 * time.Second)
|
||||
@ -630,7 +630,7 @@ func JobWorker(id int, jobs <-chan Job) {
|
||||
//log.Printf("jobWorker[" + strconv.Itoa(id) + "] : Starting.")
|
||||
// FIXME : discard timed out jobs
|
||||
for j := range jobs {
|
||||
log.Printf("JobWorker[%d] : Starting job %d (timeout : %s).\n", id, j.ID64, j.Timeout.Format(time.RFC3339))
|
||||
//log.Printf("JobWorker[%d] : Starting job %d (timeout : %s).\n", id, j.ID64, j.Timeout.Format(time.RFC3339))
|
||||
if time.Now().UTC().Before(j.Timeout) {
|
||||
switch j.JobTypeID64 {
|
||||
case cacheObjSubType[`job_rescan_msg`]:
|
||||
|
Loading…
Reference in New Issue
Block a user