优化结构
This commit is contained in:
@@ -23,9 +23,6 @@ type TaskExecutor struct {
|
||||
}
|
||||
|
||||
func NewTaskExecutorWithRegistry(tasks *taskbiz.TaskUsecase, methods taskbiz.TaskMethodRegistry) *TaskExecutor {
|
||||
if methods == nil {
|
||||
methods = taskbiz.DefaultTaskMethodRegistry()
|
||||
}
|
||||
return &TaskExecutor{tasks: tasks, methods: methods}
|
||||
}
|
||||
|
||||
@@ -139,8 +136,6 @@ func (e *TaskExecutor) runMethod(ctx context.Context, task *taskbiz.TimedTask) e
|
||||
var ok bool
|
||||
if e.methods != nil {
|
||||
method, ok = e.methods.Lookup(task.MethodName)
|
||||
} else {
|
||||
method, ok = taskbiz.TaskMethodByName(task.MethodName)
|
||||
}
|
||||
if !ok {
|
||||
return fmt.Errorf("方法 %s 未注册(需通过 platform/task.Registry 注册)", task.MethodName)
|
||||
|
||||
Reference in New Issue
Block a user