fix
This commit is contained in:
parent
c495882021
commit
73ed495bd3
33
sql.go
33
sql.go
@ -965,6 +965,7 @@ func cleanupJobData() {
|
|||||||
jobID int64
|
jobID int64
|
||||||
count int64
|
count int64
|
||||||
countObjDeleted int64
|
countObjDeleted int64
|
||||||
|
countJobDeleted int64
|
||||||
isDone int
|
isDone int
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1024,10 +1025,10 @@ func cleanupJobData() {
|
|||||||
}
|
}
|
||||||
del, err := delObj.RowsAffected()
|
del, err := delObj.RowsAffected()
|
||||||
logOnError(err, "cleanupJobData : rows delObj")
|
logOnError(err, "cleanupJobData : rows delObj")
|
||||||
countObjDeleted += del
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
countObjDeleted += del
|
||||||
log.Printf("cleanupJobData : delObj : %d\n", del)
|
log.Printf("cleanupJobData : delObj : %d\n", del)
|
||||||
} else {
|
} else {
|
||||||
logOnError(err, "cleanupJobData : scan doneStmt")
|
logOnError(err, "cleanupJobData : scan doneStmt")
|
||||||
@ -1035,25 +1036,25 @@ func cleanupJobData() {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Printf("cleanupJobData : isDone : %d\n", isDone)
|
log.Printf("cleanupJobData : isDone : %d\n", isDone)
|
||||||
|
if isDone == 1 {
|
||||||
|
delJob, err := delJobStmt.Exec(jobID)
|
||||||
|
logOnError(err, "cleanupJobData : exec delJobStmt")
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
del, err := delJob.RowsAffected()
|
||||||
|
logOnError(err, "cleanupJobData : rows delJob")
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
countJobDeleted += del
|
||||||
|
log.Printf("cleanupJobData : delJob : %d\n", del)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
count += 1
|
count += 1
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("cleanupJobData : %d jobs scanned, %d obj deleted\n", count, countObjDeleted)
|
log.Printf("cleanupJobData : %d jobs scanned, %d obj deleted, %d job deleted\n", count, countObjDeleted, countJobDelted)
|
||||||
|
|
||||||
/*
|
|
||||||
for _, id := range ids {
|
|
||||||
job, err := db.Query(`SELECT oj.is_done FROM obj_job oj WHERE oj.obj_id = ?;`)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer jobs.Close()
|
|
||||||
stmt, err := db.Prepare(`DELETE FROM obj WHERE id = ?`)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer stmt.Close()
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user