Skip to content

Commit

Permalink
#419 exit if too old
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Dec 19, 2024
1 parent 6b60796 commit f9d3c23
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/incremate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
# Incrementaly accumulates data into a fact, using Ruby scripts
# found in the directory provided, by the prefix.
def Jp.incremate(fact, dir, prefix)
if Time.now - $start > 15 * 60
$loog.info('We are busy for too long already, won\'t run incremate')
return
end
start = Time.now
Dir[File.join(dir, "#{prefix}_*.rb")].each do |rb|
n = File.basename(rb).gsub(/\.rb$/, '')
Expand Down
1 change: 1 addition & 0 deletions test/test__helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def load_it(judge, fb, options = Judges::Options.new({ 'repositories' => 'foo/fo
$judge = judge
$options = options
$loog = Loog::NULL
$start = Time.now
load(File.join(__dir__, "../judges/#{judge}/#{judge}.rb"))
end

Expand Down

0 comments on commit f9d3c23

Please sign in to comment.