fix delay in jobs

This commit is contained in:
shoopea 2020-02-07 12:05:01 +08:00
parent c232fcd48c
commit abd437ba60

14
job.go
View File

@ -2301,7 +2301,7 @@ func jobShopsSlave(j Job) {
rescheduleJob(j.ID64, 0, time.Unix(maxUnixTimestamp, 0).UTC()) // reschedule so that it gets picked up by shop main ack callback rescheduleJob(j.ID64, 0, time.Unix(maxUnixTimestamp, 0).UTC()) // reschedule so that it gets picked up by shop main ack callback
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_shop_main_req`]) setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_shop_main_req`])
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_shop_main_ack`]) setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_shop_main_ack`])
clientSendCWMsgDelay(j.UserID64, fmt.Sprintf("/ws_%s", p.Shops[0]), 6) clientSendCWMsgDelay(j.UserID64, fmt.Sprintf("/ws_%s", p.Shops[0]), 6*time.Second)
return return
} }
@ -2413,7 +2413,7 @@ func jobGetVault(j Job) {
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_res_req`]) setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_res_req`])
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_any_ack`]) setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_any_ack`])
rescheduleJob(j.ID64, 0, time.Unix(maxUnixTimestamp, 0).UTC()) rescheduleJob(j.ID64, 0, time.Unix(maxUnixTimestamp, 0).UTC())
clientSendCWMsgDelay(j.UserID64, `/g_stock_res`, 4) clientSendCWMsgDelay(j.UserID64, `/g_stock_res`, 4*time.Second)
return return
} else if (p.Status & reqTab[cacheObjSubType[`item_alch`]]) == reqTab[cacheObjSubType[`item_alch`]] { } else if (p.Status & reqTab[cacheObjSubType[`item_alch`]]) == reqTab[cacheObjSubType[`item_alch`]] {
p.Status = p.Status &^ reqTab[cacheObjSubType[`item_alch`]] p.Status = p.Status &^ reqTab[cacheObjSubType[`item_alch`]]
@ -2422,7 +2422,7 @@ func jobGetVault(j Job) {
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_alch_req`]) setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_alch_req`])
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_any_ack`]) setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_any_ack`])
rescheduleJob(j.ID64, 0, time.Unix(maxUnixTimestamp, 0).UTC()) rescheduleJob(j.ID64, 0, time.Unix(maxUnixTimestamp, 0).UTC())
clientSendCWMsgDelay(j.UserID64, `/g_stock_alch`, 4) clientSendCWMsgDelay(j.UserID64, `/g_stock_alch`, 4*time.Second)
return return
} else if (p.Status & reqTab[cacheObjSubType[`item_misc`]]) == reqTab[cacheObjSubType[`item_misc`]] { } else if (p.Status & reqTab[cacheObjSubType[`item_misc`]]) == reqTab[cacheObjSubType[`item_misc`]] {
p.Status = p.Status &^ reqTab[cacheObjSubType[`item_misc`]] p.Status = p.Status &^ reqTab[cacheObjSubType[`item_misc`]]
@ -2431,7 +2431,7 @@ func jobGetVault(j Job) {
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_misc_req`]) setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_misc_req`])
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_any_ack`]) setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_any_ack`])
rescheduleJob(j.ID64, 0, time.Unix(maxUnixTimestamp, 0).UTC()) rescheduleJob(j.ID64, 0, time.Unix(maxUnixTimestamp, 0).UTC())
clientSendCWMsgDelay(j.UserID64, `/g_stock_misc`, 4) clientSendCWMsgDelay(j.UserID64, `/g_stock_misc`, 4*time.Second)
return return
} else if (p.Status & reqTab[cacheObjSubType[`item_recipe`]]) == reqTab[cacheObjSubType[`item_recipe`]] { } else if (p.Status & reqTab[cacheObjSubType[`item_recipe`]]) == reqTab[cacheObjSubType[`item_recipe`]] {
p.Status = p.Status &^ reqTab[cacheObjSubType[`item_recipe`]] p.Status = p.Status &^ reqTab[cacheObjSubType[`item_recipe`]]
@ -2440,7 +2440,7 @@ func jobGetVault(j Job) {
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_rec_req`]) setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_rec_req`])
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_any_ack`]) setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_any_ack`])
rescheduleJob(j.ID64, 0, time.Unix(maxUnixTimestamp, 0).UTC()) rescheduleJob(j.ID64, 0, time.Unix(maxUnixTimestamp, 0).UTC())
clientSendCWMsgDelay(j.UserID64, `/g_stock_rec`, 4) clientSendCWMsgDelay(j.UserID64, `/g_stock_rec`, 4*time.Second)
return return
} else if (p.Status & reqTab[cacheObjSubType[`item_part`]]) == reqTab[cacheObjSubType[`item_part`]] { } else if (p.Status & reqTab[cacheObjSubType[`item_part`]]) == reqTab[cacheObjSubType[`item_part`]] {
p.Status = p.Status &^ reqTab[cacheObjSubType[`item_part`]] p.Status = p.Status &^ reqTab[cacheObjSubType[`item_part`]]
@ -2449,7 +2449,7 @@ func jobGetVault(j Job) {
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_part_req`]) setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_part_req`])
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_any_ack`]) setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_any_ack`])
rescheduleJob(j.ID64, 0, time.Unix(maxUnixTimestamp, 0).UTC()) rescheduleJob(j.ID64, 0, time.Unix(maxUnixTimestamp, 0).UTC())
clientSendCWMsgDelay(j.UserID64, `/g_stock_parts`, 4) clientSendCWMsgDelay(j.UserID64, `/g_stock_parts`, 4*time.Second)
return return
} else if (p.Status & reqTab[cacheObjSubType[`item_other`]]) == reqTab[cacheObjSubType[`item_other`]] { } else if (p.Status & reqTab[cacheObjSubType[`item_other`]]) == reqTab[cacheObjSubType[`item_other`]] {
p.Status = p.Status &^ reqTab[cacheObjSubType[`item_other`]] p.Status = p.Status &^ reqTab[cacheObjSubType[`item_other`]]
@ -2458,7 +2458,7 @@ func jobGetVault(j Job) {
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_oth_req`]) setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_oth_req`])
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_any_ack`]) setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_any_ack`])
rescheduleJob(j.ID64, 0, time.Unix(maxUnixTimestamp, 0).UTC()) rescheduleJob(j.ID64, 0, time.Unix(maxUnixTimestamp, 0).UTC())
clientSendCWMsgDelay(j.UserID64, `/g_stock_other`, 4) clientSendCWMsgDelay(j.UserID64, `/g_stock_other`, 4*time.Second)
return return
} else { } else {
setJobPayloadJSON(j.ID64, p) setJobPayloadJSON(j.ID64, p)