feat(tasks): removed unnecessary wrapper

This commit is contained in:
Alexander 2025-03-25 17:16:57 +01:00
parent 35f63a8fb1
commit 0d4c256ca8

View file

@ -29,7 +29,7 @@ type Task struct {
Duration int Duration int
Status string Status string
Path string Path string
tx pool.Tx tx *pool.Tx
} }
func (t *Task) HasToTrim() bool { func (t *Task) HasToTrim() bool {
@ -65,7 +65,7 @@ func (t *tasksImpl) Get() (task *Task, err error) {
} }
}() }()
task = &Task{tx: pool.Tx{Tx: tx}} task = &Task{tx: tx}
sql := `SELECT spot_id, crop, duration FROM spots.tasks WHERE status = 'pending' ORDER BY added_time FOR UPDATE SKIP LOCKED LIMIT 1` sql := `SELECT spot_id, crop, duration FROM spots.tasks WHERE status = 'pending' ORDER BY added_time FOR UPDATE SKIP LOCKED LIMIT 1`
err = tx.TxQueryRow(sql).Scan(&task.SpotID, &task.Crop, &task.Duration) err = tx.TxQueryRow(sql).Scan(&task.SpotID, &task.Crop, &task.Duration)
if err != nil { if err != nil {