-
-
Notifications
You must be signed in to change notification settings - Fork 292
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
issue-677: support task creation with variadic args #755
Conversation
scheduler.go
Outdated
@@ -535,6 +535,47 @@ func (s *scheduler) NewJob(jobDefinition JobDefinition, task Task, options ...Jo | |||
return s.addOrUpdateJob(uuid.Nil, jobDefinition, task, options) | |||
} | |||
|
|||
func (s *scheduler) verifyParameterType(taskFunc reflect.Value, tsk task) error { | |||
isVariadic := taskFunc.Type().IsVariadic() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 epic, i was poking around the other day but didn't notice this IsVariadic method
}, | ||
{ | ||
"all good no arguments passed in - variadic", | ||
NewTask(func(args ...interface{}) {}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you add a test case with multiple argument types where the last one is variadic?
something like
NewTask(func(arg int, args ...string) {}, 1, "one", "two")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure this was neglected in my previous commit. And it's added now in this PR. Please have a look.
What does this do?
This pull request implements variadic args support for task creation
Which issue(s) does this PR fix/relate to?
Resolves #677
List any changes that modify/break current functionality
Have you included tests for your changes?
I have added several cases in
scheduler_test.go
based on my changesDid you document any new/modified functionality?
scheduler_test.go
Notes