|
@ -86,15 +86,15 @@ func (TempLowHead3A60 *Temp3A60) getXorm() *xorm.Engine { |
|
|
|
|
|
|
|
|
// 队列状态
|
|
|
// 队列状态
|
|
|
const ( |
|
|
const ( |
|
|
Temp3A60QueueWait = 2 * time.Second |
|
|
|
|
|
Temp3A60QueueStatusNone = "None" |
|
|
|
|
|
Temp3A60QueueStatusIng = "Ing" |
|
|
|
|
|
Temp3A60QueueStatusSuccess = "Success" |
|
|
|
|
|
Temp3A60QueueStatusFail = "Fail" |
|
|
|
|
|
|
|
|
TempLowHead3A60_AutoQueueWait = 2 * time.Second |
|
|
|
|
|
TempLowHead3A60_AutoQueueStatusNone = "None" |
|
|
|
|
|
TempLowHead3A60_AutoQueueStatusIng = "Ing" |
|
|
|
|
|
TempLowHead3A60_AutoQueueStatusSuccess = "Success" |
|
|
|
|
|
TempLowHead3A60_AutoQueueStatusFail = "Fail" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
// 不同service对应的不同队列状态
|
|
|
// 不同service对应的不同队列状态
|
|
|
var Temp3A60QueueStatusFieldMap = map[string]string{ |
|
|
|
|
|
|
|
|
var TempLowHead3A60_AutoQueueStatusFieldMap = map[string]string{ |
|
|
"service": "queue_status", |
|
|
"service": "queue_status", |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -280,7 +280,7 @@ func (TempLowHead3A60 *Temp3A60) Delete() (err error) { |
|
|
|
|
|
|
|
|
func StartQueueTaskPrefixHigHead3A60Temp3A60() { |
|
|
func StartQueueTaskPrefixHigHead3A60Temp3A60() { |
|
|
serviceName := "Prefix3A60" |
|
|
serviceName := "Prefix3A60" |
|
|
f := Temp3A60QueueStatusFieldMap[serviceName] |
|
|
|
|
|
|
|
|
f := TempLowHead3A60_AutoQueueStatusFieldMap[serviceName] |
|
|
go func() { |
|
|
go func() { |
|
|
defer func() { |
|
|
defer func() { |
|
|
err := recover() |
|
|
err := recover() |
|
@ -294,7 +294,7 @@ func StartQueueTaskPrefixHigHead3A60Temp3A60() { |
|
|
|
|
|
|
|
|
for { |
|
|
for { |
|
|
onec := &Temp3A60{} |
|
|
onec := &Temp3A60{} |
|
|
hskdb.GetXormAuto().Where(fmt.Sprintf("`%s`=?", f), Temp3A60QueueStatusNone).OrderBy("rand()").Find(&onec) |
|
|
|
|
|
|
|
|
hskdb.GetXormAuto().Where(fmt.Sprintf("`%s`=?", f), TempLowHead3A60_AutoQueueStatusNone).OrderBy("rand()").Find(&onec) |
|
|
|
|
|
|
|
|
session := onec.getXorm().NewSession() |
|
|
session := onec.getXorm().NewSession() |
|
|
defer session.Close() |
|
|
defer session.Close() |
|
@ -307,7 +307,7 @@ func StartQueueTaskPrefixHigHead3A60Temp3A60() { |
|
|
session = session.Where(whereCond) |
|
|
session = session.Where(whereCond) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
i, err := session.Where(fmt.Sprintf("`%s`=?", f), Temp3A60QueueStatusNone).Update(map[string]interface{}{f: Temp3A60QueueStatusIng}) |
|
|
|
|
|
|
|
|
i, err := session.Where(fmt.Sprintf("`%s`=?", f), TempLowHead3A60_AutoQueueStatusNone).Update(map[string]interface{}{f: TempLowHead3A60_AutoQueueStatusIng}) |
|
|
if err == nil && i == 1 { |
|
|
if err == nil && i == 1 { |
|
|
func() { |
|
|
func() { |
|
|
{ |
|
|
{ |
|
@ -323,14 +323,14 @@ func StartQueueTaskPrefixHigHead3A60Temp3A60() { |
|
|
session = session.Where(whereCond) |
|
|
session = session.Where(whereCond) |
|
|
} |
|
|
} |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
session.Where(fmt.Sprintf("`%s`=?", f), Temp3A60QueueStatusNone).Update(map[string]interface{}{f: Temp3A60QueueStatusFail}) |
|
|
|
|
|
|
|
|
session.Where(fmt.Sprintf("`%s`=?", f), TempLowHead3A60_AutoQueueStatusNone).Update(map[string]interface{}{f: TempLowHead3A60_AutoQueueStatusFail}) |
|
|
} else { |
|
|
} else { |
|
|
session.Where(fmt.Sprintf("`%s`=?", f), Temp3A60QueueStatusNone).Update(map[string]interface{}{f: Temp3A60QueueStatusSuccess}) |
|
|
|
|
|
|
|
|
session.Where(fmt.Sprintf("`%s`=?", f), TempLowHead3A60_AutoQueueStatusNone).Update(map[string]interface{}{f: TempLowHead3A60_AutoQueueStatusSuccess}) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}() |
|
|
}() |
|
|
} |
|
|
} |
|
|
time.Sleep(Temp3A60QueueWait) |
|
|
|
|
|
|
|
|
time.Sleep(TempLowHead3A60_AutoQueueWait) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}() |
|
|
}() |
|
|