Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-04-04 10:58:02 +0300
committerShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-04-06 17:46:58 +0300
commitf6be8c048555f2d1086e7beed336b6187edb4d58 (patch)
tree9db3fa385b3dfca6f02dcafa176ceb0a1b9a7f7d
parenta67aff6d398467099121e7a7b4a542ff531d3f45 (diff)
Remove less_than_1_hour_from_now comments. Dry up def schedule_next_run!
-rw-r--r--app/models/ci/trigger_schedule.rb22
1 files changed, 1 insertions, 21 deletions
diff --git a/app/models/ci/trigger_schedule.rb b/app/models/ci/trigger_schedule.rb
index 58337b34d80..6e7c0b4f6c2 100644
--- a/app/models/ci/trigger_schedule.rb
+++ b/app/models/ci/trigger_schedule.rb
@@ -14,32 +14,12 @@ module Ci
validates :cron, cron: true, presence: { unless: :importing? }
validates :cron_time_zone, presence: { unless: :importing? }
validates :ref, presence: { unless: :importing? }
- # validate :check_cron_frequency
after_create :schedule_next_run!
def schedule_next_run!
next_time = Ci::CronParser.new(cron, cron_time_zone).next_time_from(Time.now)
-
- # if next_time.present? && !less_than_1_hour_from_now?(next_time)
- if next_time.present?
- update!(next_run_at: next_time)
- end
+ update!(next_run_at: next_time) if next_time.present?
end
-
- # private
-
- # def less_than_1_hour_from_now?(time)
- # puts "diff: #{(time - Time.now).abs.inspect}"
- # ((time - Time.now).abs < 1.hour) ? true : false
- # end
-
- # def check_cron_frequency
- # next_time = Ci::CronParser.new(cron, cron_time_zone).next_time_from(Time.now)
-
- # if less_than_1_hour_from_now?(next_time)
- # self.errors.add(:cron, " can not be less than 1 hour")
- # end
- # end
end
end