summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-04-01 23:27:24 +0900
committerShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-04-06 23:46:58 +0900
commit97cc6777368bfe171198af383bf715629e9b076f (patch)
tree7f32a9e7aef365cb234457653712eea9b0b29581 /app/models
parent1bd5494942853decbcd67434ef592ca2523a777b (diff)
downloadgitlab-ce-97cc6777368bfe171198af383bf715629e9b076f.tar.gz
Commentout check_cron_frequency
Diffstat (limited to 'app/models')
-rw-r--r--app/models/ci/trigger_schedule.rb26
1 files changed, 14 insertions, 12 deletions
diff --git a/app/models/ci/trigger_schedule.rb b/app/models/ci/trigger_schedule.rb
index 6529e364fe8..be547af2114 100644
--- a/app/models/ci/trigger_schedule.rb
+++ b/app/models/ci/trigger_schedule.rb
@@ -13,30 +13,32 @@ module Ci
validates :cron, cron: true, presence: true
validates :cron_time_zone, presence: true
validates :ref, ref: true, presence: true
- validate :check_cron_frequency
+ # 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? && !less_than_1_hour_from_now?(next_time)
+ if next_time.present?
update!(next_run_at: next_time)
end
end
- private
+ # private
- def less_than_1_hour_from_now?(time)
- ((time - Time.now).abs < 1.hour) ? true : false
- end
+ # 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)
+ # 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
+ # if less_than_1_hour_from_now?(next_time)
+ # self.errors.add(:cron, " can not be less than 1 hour")
+ # end
+ # end
end
end