-
Notifications
You must be signed in to change notification settings - Fork 72
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
Resolve next scheduling ploblems #76
Conversation
app/models/kuroko2/job_schedule.rb
Outdated
|
||
launch_schedule = Chrono::Schedule.new(cron) | ||
schedule = CHRONO_SCHEDULE_METHODS.each_with_object({}) do |method, h| | ||
h[method] = launch_schedule.send(method) |
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.
[nits] Use public_send
to clarify that it doesn't try to call private method.
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.
app/models/kuroko2/job_schedule.rb
Outdated
job_definition.job_suspend_schedules.each do |suspend_schedule_model| | ||
suspend_schedule = Chrono::Schedule.new(suspend_schedule_model.cron) | ||
CHRONO_SCHEDULE_METHODS.each do |method| | ||
schedule[method] = schedule[method] - suspend_schedule.send(method) |
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.
[nits] schedule[method] -= suspended_schedule.public_send(method)
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.
td data-value=next_job_schedule.to_i = l(next_job_schedule, format: :short) | ||
- else | ||
td data-value="9999999990" | ||
span class="small" Suspended |
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 think "Suspended" is confusing word because job definition has "suspended" status and it is displayed as "--".
spec/models/job_schedule_spec.rb
Outdated
context 'If the schedule has wdays and days' do | ||
let(:cron) { '0 10 2 * 0' } | ||
it 'returns nil' do | ||
expect(schedule.next(time)).to eq(Time.new(2016, 2, 2, 10, 0)) |
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.
[nits] Says "it returns nil" but does not return nil
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.
🙈 ammended b192059
spec/models/job_schedule_spec.rb
Outdated
context 'If the schedule has wdays and days' do | ||
let(:cron) { '0 10 1 * 1' } | ||
it 'returns nil' do | ||
expect(schedule.next(time)).to eq(Time.new(2016, 1, 4, 10, 0)) |
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.
[nits] ditto.
Remove 1 month since limitation, and add checking
suspended_all?
eisuke@31d37c6 using Chrono::ScheduleSearching next
schedules costs has been improved eisuke@dc95ab9
Fix infinite loop when suspend schedule has wdays and days eisuke@5ba258f
@cookpad/dev-infra please review