This is an automated email from the ASF dual-hosted git repository.

jin pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/incubator-hugegraph-computer.git


The following commit(s) were added to refs/heads/master by this push:
     new 8eb16b4e refactor(vermeer): make startChan's size configurable (#328)
8eb16b4e is described below

commit 8eb16b4eacf4e0243682b504280df9ab90ef2cd4
Author: Ethereal-O <[email protected]>
AuthorDate: Fri May 30 14:42:23 2025 +0800

    refactor(vermeer): make startChan's size configurable (#328)
    
    * refactor(startChan): make startChan's size configurable
    
    * Update vermeer/config/master.ini
    
    ---------
    
    Co-authored-by: imbajin <[email protected]>
---
 vermeer/apps/master/bl/scheduler_bl.go | 13 ++++++++++++-
 vermeer/config/master.ini              |  3 ++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/vermeer/apps/master/bl/scheduler_bl.go 
b/vermeer/apps/master/bl/scheduler_bl.go
index 0f1af095..bc4ccac4 100644
--- a/vermeer/apps/master/bl/scheduler_bl.go
+++ b/vermeer/apps/master/bl/scheduler_bl.go
@@ -19,7 +19,9 @@ package bl
 
 import (
        "errors"
+       "strconv"
        "time"
+       "vermeer/apps/common"
        "vermeer/apps/master/schedules"
        "vermeer/apps/structure"
 
@@ -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()
diff --git a/vermeer/config/master.ini b/vermeer/config/master.ini
index d5897031..8a7adb13 100644
--- a/vermeer/config/master.ini
+++ b/vermeer/config/master.ini
@@ -23,4 +23,5 @@ run_mode=master
 task_strategy=1
 task_parallel_num=1
 auth=none
-auth_token_factor=1234
\ No newline at end of file
+auth_token_factor=1234
+start_chan_size=10

Reply via email to