From cc07d5ebbe5cf72cf07da75cf89d6a16fd979fe7 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Thu, 19 Dec 2024 15:45:44 +0300 Subject: [PATCH] skip if too long --- judges/find-all-issues/find-all-issues.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/judges/find-all-issues/find-all-issues.rb b/judges/find-all-issues/find-all-issues.rb index ce94306f..ebe1ac3a 100644 --- a/judges/find-all-issues/find-all-issues.rb +++ b/judges/find-all-issues/find-all-issues.rb @@ -30,6 +30,7 @@ require 'fbe/who' require 'fbe/issue' +start = Time.now Fbe.iterate do as 'min-issue-was-found' by "(agg (and (eq where 'github') (eq repository $repository) (eq what 'issue-was-opened')) (min issue))" @@ -41,8 +42,12 @@ rescue Octokit::NotFound next 0 end + if Time.now - start > 5 * 60 + $loog.info("We are doing this for #{start.ago} already, won't check #{repo}") + next issue + end total = 0 - start = Time.now + before = Time.now Fbe.octo.search_issues("repo:#{repo} type:issue created:<=#{after.iso8601[0..9]}")[:items].each do |json| total += 1 f = @@ -57,7 +62,7 @@ f.who = json.dig(:user, :id) f.details = "The issue #{Fbe.issue(f)} has been opened by #{Fbe.who(f)}." end - $loog.info("Checked #{total} issues in #{repo} in #{start.ago}") + $loog.info("Checked #{total} issues in #{repo} in #{before.ago}") issue end end