on service restart clean up mid way tasks closes #95

This commit is contained in:
2024-04-16 18:19:43 +01:00
parent 06642dcb1e
commit f165e9e744
3 changed files with 55 additions and 12 deletions

View File

@@ -7,7 +7,6 @@ import (
"github.com/charmbracelet/log"
_ "github.com/lib/pq"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/db_types"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/models"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/tasks"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/tasks/runner"
@@ -15,7 +14,6 @@ import (
)
const (
clear_db = false
host = "localhost"
port = 5432
user = "postgres"
@@ -46,12 +44,7 @@ func main() {
//TODO check if file structure exists to save data
handle := NewHandler(db, config)
// TODO remove this before commiting
_, err = db.Exec("update models set status=$1 where status=$2", FAILED_TRAINING, TRAINING)
if err != nil && clear_db {
log.Warn("Database might not be on")
panic(err)
}
config.Cleanup(db)
// TODO Handle this in other way
handle.ReadTypesFilesApi("/savedData/", ".", []string{".png", ".jpeg"}, []string{"image/png", "image/jpeg"})