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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
6fba1c22
Commit
6fba1c22
authored
May 02, 2019
by
Fabio Pitino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rescue RuntimeError when "too many loops" are reached by Fugit::Cron
parent
9b3b7a58
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
lib/gitlab/ci/cron_parser.rb
lib/gitlab/ci/cron_parser.rb
+9
-1
No files found.
lib/gitlab/ci/cron_parser.rb
View file @
6fba1c22
...
@@ -13,7 +13,7 @@ module Gitlab
...
@@ -13,7 +13,7 @@ module Gitlab
def
next_time_from
(
time
)
def
next_time_from
(
time
)
@cron_line
||=
try_parse_cron
(
@cron
,
@cron_timezone
)
@cron_line
||=
try_parse_cron
(
@cron
,
@cron_timezone
)
@cron_line
.
next_time
(
time
).
utc
.
in_time_zone
(
Time
.
zon
e
)
if
@cron_line
.
present?
find_next_time
(
tim
e
)
if
@cron_line
.
present?
end
end
def
cron_valid?
def
cron_valid?
...
@@ -49,6 +49,14 @@ module Gitlab
...
@@ -49,6 +49,14 @@ module Gitlab
def
try_parse_cron
(
cron
,
cron_timezone
)
def
try_parse_cron
(
cron
,
cron_timezone
)
Fugit
::
Cron
.
parse
(
"
#{
cron
}
#{
cron_timezone
}
"
)
Fugit
::
Cron
.
parse
(
"
#{
cron
}
#{
cron_timezone
}
"
)
end
end
def
find_next_time
(
time
)
@cron_line
.
next_time
(
time
).
utc
.
in_time_zone
(
Time
.
zone
)
rescue
RuntimeError
=>
error
raise
error
unless
error
.
message
=~
/too many loops/
# Fugit::Cron raises a RuntimeError if :next_time does not find the next schedule
# given an invalid pattern - E.g. try_parse_cron('0 12 31 2 *')
end
end
end
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