-
Notifications
You must be signed in to change notification settings - Fork 141
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
Error When an Invalid Recurring Task is Configured #427
Conversation
Thanks a lot @jherdman! I was thinking that perhaps this should be part of a more generic configuration validation that runs and raises before starting the supervisor 🤔 |
Perhaps we need both things? Since the recurring jobs are just DB backed, and have validations, we probably need to report on those validation errors should they occur. |
Right, I mean doing this as part of that configuration validation that runs before the supervisor starts, instead of waiting until we try to schedule them. |
I can take a crack at your suggestion unless you have something very specific in mind. |
2657a3c
to
20169c7
Compare
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.
@rosa take two! I think this is more in line with what you noted above.
lib/solid_queue/configuration.rb
Outdated
@@ -36,6 +36,14 @@ def configured_processes | |||
end | |||
end | |||
|
|||
def valid? | |||
skip_recurring_tasks? || recurring_tasks.none? || recurring_tasks.all?(&:valid?) |
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.
I feel like this is probably not exhaustive enough, but I'm unsure of other cases to expand upon. This is probably sufficient for the scope of this PR though.
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 we include perhaps the case of no configured processes? So we could unify that call in the Supervisor, instead of having two separate checks?
Besides that, I think you can skip recurring_tasks.none?
because if recurring_tasks
is empty, recurring_tasks.all?(&:valid?)
will return true
.
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.
Ugh... seems so obvious after you pointed it out 😅
I hope you don't mind, but I've kept the two distinct error messages. It feels like the verbose invalid task error message would be helpful.
Asserting on the abort message ensures we're not aborting for some other reason.
e25ebd8
to
a743f27
Compare
a743f27
to
b0534f0
Compare
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.
Wonderful! Thank you so much, @jherdman! 🙏 🙇♀️
I took a first crack at resolving #414. I think it's a little bit of a blunt solution.
Resolves #414