Skip to content

Commit

Permalink
Add concurrency to HadesScheduler Config (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertjndw authored Jan 29, 2024
1 parent 40054fd commit d003429
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions HadesScheduler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,27 @@ type JobScheduler interface {
ScheduleJob(ctx context.Context, job payload.QueuePayload) error
}

type HadesSchedulerConfig struct {
Concurrency uint `env:"CONCURRENCY" envDefault:"1"`
RedisConfig utils.RedisConfig
}

func main() {
if is_debug := os.Getenv("DEBUG"); is_debug == "true" {
log.SetLevel(log.DebugLevel)
log.Warn("DEBUG MODE ENABLED")
}

var cfg utils.RedisConfig
var cfg HadesSchedulerConfig
utils.LoadConfig(&cfg)

var executorCfg utils.ExecutorConfig
utils.LoadConfig(&executorCfg)
log.Debug("Executor config: ", executorCfg)

var err error
AsynqServer = asynq.NewServer(asynq.RedisClientOpt{Addr: cfg.Addr}, asynq.Config{
Concurrency: 1,
AsynqServer = asynq.NewServer(asynq.RedisClientOpt{Addr: cfg.RedisConfig.Addr}, asynq.Config{
Concurrency: int(cfg.Concurrency),
Queues: map[string]int{
"critical": 5,
"high": 4,
Expand Down

0 comments on commit d003429

Please sign in to comment.