Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
f6be8c04
Commit
f6be8c04
authored
Apr 04, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove less_than_1_hour_from_now comments. Dry up def schedule_next_run!
parent
a67aff6d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
21 deletions
+1
-21
app/models/ci/trigger_schedule.rb
app/models/ci/trigger_schedule.rb
+1
-21
No files found.
app/models/ci/trigger_schedule.rb
View file @
f6be8c04
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment