Skip to content

Commit 2cc6815

Browse files
committed
add ValidateTaskType
1 parent d47ad95 commit 2cc6815

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

tasks.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"os"
88
"runtime/debug"
99
"strconv"
10+
"strings"
1011
"sync"
1112
)
1213

@@ -392,3 +393,15 @@ func (service *TaskService) defaultLogCounterInfo(ctx *TaskContext) error {
392393
}
393394
return nil
394395
}
396+
397+
// ValidateTaskType validate the TaskType is supported
398+
func ValidateTaskType(taskType string) bool {
399+
if taskType == "" {
400+
return false
401+
}
402+
checkType := strings.ToLower(taskType)
403+
if checkType != TaskType_Cron && checkType != TaskType_Loop && checkType != TaskType_Queue {
404+
return false
405+
}
406+
return true
407+
}

0 commit comments

Comments
 (0)