This commit is contained in:
parent
8c3ba7e883
commit
57969cc07d
7 changed files with 99 additions and 12 deletions
|
@ -375,7 +375,8 @@ func assignQueuedTasks(ctx context.Context) error {
|
|||
}
|
||||
if Workers[i].Connected {
|
||||
var queueEnable bool
|
||||
err := db.QueryRow(ctx, "SELECT queue_enable FROM workers WHERE id = $1", i).Scan(&queueEnable)
|
||||
var parallelTasks int
|
||||
err := db.QueryRow(ctx, "SELECT queue_enable, parallel_tasks FROM workers WHERE id = $1", i).Scan(&queueEnable, ¶llelTasks)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error Querying Worker Queue Enable: %w", err)
|
||||
}
|
||||
|
@ -393,7 +394,7 @@ func assignQueuedTasks(ctx context.Context) error {
|
|||
slog.Debug("Assigning Queued Tasks Worker", "worker", i, "count", count)
|
||||
|
||||
// Allow for Multiple Tasks at once in the future
|
||||
if count < 1 {
|
||||
if count < parallelTasks {
|
||||
tx, err := db.Begin(ctx)
|
||||
defer tx.Rollback(ctx)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue