Class: Kuroko2::JobSuspendSchedule

Inherits:
ApplicationRecord show all
Includes:
TableNameCustomizable
Defined in:
app/models/kuroko2/job_suspend_schedule.rb

Instance Method Summary collapse

Instance Method Details

#suspend_times(time_from, time_to) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/models/kuroko2/job_suspend_schedule.rb', line 9

def suspend_times(time_from, time_to)
  it = Chrono::Iterator.new(cron, now: time_from - 1)
  suspend_times = []

  loop do
    next_time = it.next
    if next_time <= time_to
      suspend_times << next_time
    else
      break
    end
  end

  suspend_times
end