Skip to content

Commit

Permalink
feat(tasks): use env variable for concurrency
Browse files Browse the repository at this point in the history
  • Loading branch information
AlirieGray committed Sep 10, 2019
1 parent 645df57 commit 9a87fda
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions task/backend/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"errors"
"fmt"
"math"
"os"
"strconv"
"sync"
"sync/atomic"
"time"
Expand Down Expand Up @@ -469,6 +471,17 @@ func newTaskScheduler(
return nil, err
}
maxC := defaultConcurrency

// if an environment variable for default concurrency is set, use this value
// this will be overwritten if the Flux script for the task has a concurrency set
if envConcurrency := os.Getenv("DEFAULT_CONCURRENCY"); envConcurrency != "" {
c, err := strconv.Atoi(envConcurrency)
if err == nil {
maxC = c

}
}

if opt.Concurrency != nil {
maxC = int(*opt.Concurrency)
}
Expand Down

0 comments on commit 9a87fda

Please sign in to comment.