imbajin commented on code in PR #336:
URL: 
https://github.com/apache/incubator-hugegraph-computer/pull/336#discussion_r2422717203


##########
vermeer/apps/master/bl/task_bl.go:
##########
@@ -62,6 +64,53 @@ func (tb *TaskBl) CreateTaskInfo(
                return nil, err
        }
 
+       // for scheduler
+       taskInfo.Priority = 0
+       taskInfo.Preorders = make([]int32, 0)
+       taskInfo.Exclusive = true // default to true for now, can be set false 
by params
+       if params != nil {
+               if priority, ok := params["priority"]; ok {

Review Comment:
   **Integer overflow risk with priority values**
   
   The priority is parsed as int64 but stored as int32, which could cause 
overflow if users provide large values.
   
   **Suggested fix:**
   ```go
   if priority, ok := params["priority"]; ok {
       p, err := strconv.ParseInt(priority, 10, 32)
       if err != nil {
           logrus.Warnf("priority parse error: %v", err)
           return nil, fmt.Errorf("invalid priority value: %v", err)
       }
       if p < 0 {
           return nil, fmt.Errorf("priority must be non-negative, got: %d", p)
       }
       if p > math.MaxInt32 {
           return nil, fmt.Errorf("priority exceeds maximum value: %d", 
math.MaxInt32)
       }
       taskInfo.Priority = int32(p)
   }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to