moved to psql pool closes #99

This commit is contained in:
2024-04-17 17:46:43 +01:00
parent 8ece8306dd
commit a3913ccdf5
14 changed files with 132 additions and 98 deletions

View File

@@ -1,7 +1,6 @@
package task_runner
import (
"database/sql"
"fmt"
"math"
"os"
@@ -10,6 +9,7 @@ import (
"github.com/charmbracelet/log"
"git.andr3h3nriqu3s.com/andr3/fyp/logic/db"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/db_types"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/models"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/models/train"
@@ -21,7 +21,7 @@ import (
/**
* Actually runs the code
*/
func runner(config Config, db *sql.DB, task_channel chan Task, index int, back_channel chan int) {
func runner(config Config, db db.Db, task_channel chan Task, index int, back_channel chan int) {
logger := log.NewWithOptions(os.Stdout, log.Options{
ReportCaller: true,
ReportTimestamp: true,
@@ -125,7 +125,7 @@ func attentionSeeker(config Config, back_channel chan int) {
/**
* Manages what worker should to Work
*/
func RunnerOrchestrator(db *sql.DB, config Config) {
func RunnerOrchestrator(db db.Db, config Config) {
logger := log.NewWithOptions(os.Stdout, log.Options{
ReportCaller: true,
ReportTimestamp: true,
@@ -211,6 +211,6 @@ func RunnerOrchestrator(db *sql.DB, config Config) {
}
}
func StartRunners(db *sql.DB, config Config) {
func StartRunners(db db.Db, config Config) {
go RunnerOrchestrator(db, config)
}