Skip to content

refactor(vermeer): make startChan's size configurable #328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion vermeer/apps/master/bl/scheduler_bl.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ package bl

import (
"errors"
"strconv"
"time"
"vermeer/apps/common"
"vermeer/apps/master/schedules"
"vermeer/apps/structure"

Expand All @@ -36,7 +38,16 @@ type ScheduleBl struct {
}

func (s *ScheduleBl) Init() {
startChan := make(chan *structure.TaskInfo, 10) // TODO: make configurable
const defaultChanSizeConfig = "10"
chanSize := common.GetConfigDefault("start_chan_size", defaultChanSizeConfig).(string)
// Convert string to int
chanSizeInt, err := strconv.Atoi(chanSize)
if err != nil {
logrus.Errorf("failed to convert start_chan_size to int: %v", err)
logrus.Infof("using default start_chan_size: %s", defaultChanSizeConfig)
chanSizeInt, _ = strconv.Atoi(defaultChanSizeConfig)
}
startChan := make(chan *structure.TaskInfo, chanSizeInt)
s.startChan = startChan
s.spaceQueue = (&schedules.SpaceQueue{}).Init()
s.broker = (&schedules.Broker{}).Init()
Expand Down
3 changes: 2 additions & 1 deletion vermeer/config/master.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ run_mode=master
task_strategy=1
task_parallel_num=1
auth=none
auth_token_factor=1234
auth_token_factor=1234
start_chan_size=10
Loading