Use database status and health, calculate md5
This commit is contained in:
parent
806f6e7e61
commit
78d818b8d1
7 changed files with 112 additions and 37 deletions
|
@ -167,6 +167,7 @@ func killDeadWorkers() {
|
|||
func updateWorkerTaskStatus(ctx context.Context) {
|
||||
var wg sync.WaitGroup
|
||||
|
||||
// TODO figure out why this locks up on worker status error
|
||||
func() {
|
||||
WorkersMutex.Lock()
|
||||
defer WorkersMutex.Unlock()
|
||||
|
@ -196,7 +197,13 @@ func updateWorkerTaskStatus(ctx context.Context) {
|
|||
_, err := rpcServer.Call(ctx, w.Conn, "task-status", tsr, &ts)
|
||||
if err != nil {
|
||||
slog.ErrorContext(ctx, "Error Getting Task Status", "err", err)
|
||||
// TODO Mark Task as Unknown?
|
||||
|
||||
_, err = db.Exec(ctx, "UPDATE tasks SET status = $2 WHERE id = $1", ts.Task.ID, constants.TASK_STATUS_UNKNOWN)
|
||||
if err != nil {
|
||||
slog.ErrorContext(ctx, "Error Updating Unknown Task Status", "err", err)
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -213,14 +220,19 @@ func updateWorkerTaskStatus(ctx context.Context) {
|
|||
slog.ErrorContext(ctx, "Error Deleting Finished Task From Worker", "err", err)
|
||||
return
|
||||
}
|
||||
|
||||
// TODO Update file health for healthcheck tasks
|
||||
}
|
||||
|
||||
}()
|
||||
}
|
||||
// TODO Handle tasks with status unkown assigned to this worker
|
||||
// maybe requeue after 5 minutes?
|
||||
|
||||
} else {
|
||||
// TODO wait for 5 minutes for worker to reconnect
|
||||
// Set Task Status to Unknown for Unfinished Tasks which where assigned to this not connected worker, right now they just get stuck
|
||||
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue