This commit is contained in:
shoopea 2020-10-20 11:38:19 +02:00
parent c495882021
commit 73ed495bd3

33
sql.go
View File

@ -965,6 +965,7 @@ func cleanupJobData() {
jobID int64
count int64
countObjDeleted int64
countJobDeleted int64
isDone int
)
@ -1024,10 +1025,10 @@ func cleanupJobData() {
}
del, err := delObj.RowsAffected()
logOnError(err, "cleanupJobData : rows delObj")
countObjDeleted += del
if err != nil {
return
}
countObjDeleted += del
log.Printf("cleanupJobData : delObj : %d\n", del)
} else {
logOnError(err, "cleanupJobData : scan doneStmt")
@ -1035,25 +1036,25 @@ func cleanupJobData() {
}
} else {
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
}
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()
}
*/
}