test
This commit is contained in:
parent
f792d2c1d2
commit
8ce9e3b0e3
23
sql.go
23
sql.go
@ -962,8 +962,9 @@ func getSQLListID64(q string) []int64 {
|
||||
|
||||
func cleanupJobData() {
|
||||
var (
|
||||
jobID int64
|
||||
count int64
|
||||
jobID int64
|
||||
count int64
|
||||
isDone int
|
||||
)
|
||||
|
||||
jobStmt, err := db.Prepare(`SELECT o.id FROM obj o WHERE o.obj_type_id = ` + strconv.FormatInt(cacheObjType[`job`], 10) + `;`)
|
||||
@ -974,12 +975,6 @@ func cleanupJobData() {
|
||||
}
|
||||
defer jobStmt.Close()
|
||||
|
||||
jobs, err := jobStmt.Query()
|
||||
logOnError(err, "cleanupJobData : query jobStmt")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
doneStmt, err := db.Prepare(`SELECT oj.is_done FROM obj_job oj WHERE oj.obj_id = ?;`)
|
||||
logOnError(err, "cleanupJobData : prepare doneStmt")
|
||||
if err != nil {
|
||||
@ -1004,6 +999,12 @@ func cleanupJobData() {
|
||||
}
|
||||
defer delObjStmt.Close()
|
||||
|
||||
jobs, err := jobStmt.Query()
|
||||
logOnError(err, "cleanupJobData : query jobStmt")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
for jobs.Next() {
|
||||
err = jobs.Scan(&jobID)
|
||||
logOnError(err, "cleanupJobData : scan jobStmt")
|
||||
@ -1011,6 +1012,12 @@ func cleanupJobData() {
|
||||
return
|
||||
}
|
||||
log.Printf("cleanupJobData : JobID : %d\n", jobID)
|
||||
err = doneStmt.QueryRow(jobID).Scan(&isDone)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
logOnError(err, "cleanupJobData : scan doneStmt")
|
||||
log.Printf("cleanupJobData : isDone : %d\n", isDone)
|
||||
|
||||
count += 1
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user