fbe 0.48.7 → 0.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/copyrights.yml +4 -0
- data/Gemfile.lock +2 -2
- data/lib/fbe/conclude.rb +23 -3
- data/lib/fbe/octo.rb +3 -0
- data/lib/fbe.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 75b5c811806afc0a6b0d5982d06a1624b6904b93ae151aa90c7cfa24d84945a0
|
|
4
|
+
data.tar.gz: 35c528503b021c5729b2400eb2c907e81fa8a5064e6ec5d14f930060e4fac685
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4117821cd66f1a138430e80ae34598440eee4de363db299997faa39fc77355dd382d73e70f9ba8f00111ccda29087e45f80e3cab1b267b270657280c7ce74864
|
|
7
|
+
data.tar.gz: 39eaa129a3ac957b5d6d675f8d8412c8c63f2a915b518b13195b3f36e3ac1f18dc47e538d2a9cce9f4c3f7381ea4c19448eec66a7b3c67e255cf481bc1b07321
|
data/Gemfile.lock
CHANGED
|
@@ -142,7 +142,7 @@ GEM
|
|
|
142
142
|
timeout (~> 0.4)
|
|
143
143
|
total (~> 0.4)
|
|
144
144
|
typhoeus (~> 1.3)
|
|
145
|
-
language_server-protocol (3.17.0.
|
|
145
|
+
language_server-protocol (3.17.0.6)
|
|
146
146
|
lint_roller (1.1.0)
|
|
147
147
|
liquid (5.12.0)
|
|
148
148
|
bigdecimal
|
|
@@ -206,7 +206,7 @@ GEM
|
|
|
206
206
|
regexp_parser (2.12.0)
|
|
207
207
|
retries (0.0.5)
|
|
208
208
|
rexml (3.4.4)
|
|
209
|
-
rubocop (1.88.
|
|
209
|
+
rubocop (1.88.2)
|
|
210
210
|
json (~> 2.3)
|
|
211
211
|
language_server-protocol (~> 3.17.0.2)
|
|
212
212
|
lint_roller (~> 1.1.0)
|
data/lib/fbe/conclude.rb
CHANGED
|
@@ -19,17 +19,20 @@ require_relative 'over'
|
|
|
19
19
|
# @param [Loog] loog The logging facility
|
|
20
20
|
# @param [Time] epoch When the entire update started
|
|
21
21
|
# @param [Time] kickoff When the particular judge started
|
|
22
|
+
# @param [Integer] slot Seconds a single iteration may need; the loop stops
|
|
23
|
+
# before starting a new one when less than this many seconds remain in the
|
|
24
|
+
# timeout (or lifetime) budget
|
|
22
25
|
# @yield [Factbase::Fact] The fact
|
|
23
26
|
def Fbe.conclude(
|
|
24
27
|
fb: Fbe.fb, judge: $judge, loog: $loog, options: $options, global: $global,
|
|
25
|
-
epoch: $epoch || Time.now, kickoff: $kickoff || Time.now, &
|
|
28
|
+
epoch: $epoch || Time.now, kickoff: $kickoff || Time.now, slot: 1, &
|
|
26
29
|
)
|
|
27
30
|
raise(Fbe::Error, 'The fb is nil') if fb.nil?
|
|
28
31
|
raise(Fbe::Error, 'The $judge is not set') if judge.nil?
|
|
29
32
|
raise(Fbe::Error, 'The $global is not set') if global.nil?
|
|
30
33
|
raise(Fbe::Error, 'The $options is not set') if options.nil?
|
|
31
34
|
raise(Fbe::Error, 'The $loog is not set') if loog.nil?
|
|
32
|
-
c = Fbe::Conclude.new(fb:, judge:, loog:, options:, global:, epoch:, kickoff:)
|
|
35
|
+
c = Fbe::Conclude.new(fb:, judge:, loog:, options:, global:, epoch:, kickoff:, slot:)
|
|
33
36
|
c.instance_eval(&)
|
|
34
37
|
end
|
|
35
38
|
|
|
@@ -66,7 +69,8 @@ class Fbe::Conclude
|
|
|
66
69
|
# @param [Loog] loog The logging facility
|
|
67
70
|
# @param [Time] epoch When the entire update started
|
|
68
71
|
# @param [Time] kickoff When the particular judge started
|
|
69
|
-
|
|
72
|
+
# @param [Integer] slot Seconds a single iteration may need
|
|
73
|
+
def initialize(fb:, judge:, global:, options:, loog:, epoch:, kickoff:, slot: 1)
|
|
70
74
|
@fb = fb
|
|
71
75
|
@judge = judge
|
|
72
76
|
@loog = loog
|
|
@@ -74,6 +78,7 @@ class Fbe::Conclude
|
|
|
74
78
|
@global = global
|
|
75
79
|
@epoch = epoch
|
|
76
80
|
@kickoff = kickoff
|
|
81
|
+
@slot = slot
|
|
77
82
|
@query = nil
|
|
78
83
|
@follows = []
|
|
79
84
|
@lifetime = true
|
|
@@ -184,6 +189,13 @@ class Fbe::Conclude
|
|
|
184
189
|
# monitoring quotas and timeouts, and processing each fact through
|
|
185
190
|
# the provided block.
|
|
186
191
|
#
|
|
192
|
+
# Besides the {Fbe.over?} check (which stops once the elapsed time crosses
|
|
193
|
+
# the fixed 90% margin of the timeout), the loop also reserves one +@slot+
|
|
194
|
+
# up front: it stops before starting a new iteration when fewer than +@slot+
|
|
195
|
+
# seconds remain in the timeout (or lifetime) budget. This prevents a slow
|
|
196
|
+
# single step from starting late and overrunning the hard timeout enforced
|
|
197
|
+
# by the +judges+ gem.
|
|
198
|
+
#
|
|
187
199
|
# @yield [Factbase::Transaction, Factbase::Fact] Transaction and the matching fact
|
|
188
200
|
# @return [Integer] The count of facts processed
|
|
189
201
|
# @example
|
|
@@ -207,6 +219,14 @@ class Fbe::Conclude
|
|
|
207
219
|
global: @global, options: @options, loog: @loog, epoch: @epoch, kickoff: @kickoff,
|
|
208
220
|
quota_aware: @quota, lifetime_aware: @lifetime, timeout_aware: @timeout
|
|
209
221
|
)
|
|
222
|
+
if @timeout && @options.timeout && @options.timeout - (Time.now - @kickoff) < @slot
|
|
223
|
+
@loog.info("Less than #{@slot}s left before the timeout, must stop here")
|
|
224
|
+
break
|
|
225
|
+
end
|
|
226
|
+
if @lifetime && @options.lifetime && @options.lifetime - (Time.now - @epoch) < @slot
|
|
227
|
+
@loog.info("Less than #{@slot}s left before the lifetime ends, must stop here")
|
|
228
|
+
break
|
|
229
|
+
end
|
|
210
230
|
@fb.txn do |fbt|
|
|
211
231
|
n = yield(fbt, a)
|
|
212
232
|
unless n.nil?
|
data/lib/fbe/octo.rb
CHANGED
|
@@ -182,6 +182,7 @@ def Fbe.octo(options: $options, global: $global, loog: $loog) # rubocop:disable
|
|
|
182
182
|
false
|
|
183
183
|
end
|
|
184
184
|
end
|
|
185
|
+
# @see https://github.com/zerocracy/pages-action/issues/131
|
|
185
186
|
def user_name_by_id(id) # rubocop:disable Layout/EmptyLineBetweenDefs
|
|
186
187
|
raise(Fbe::Error, 'The ID of the user is nil') if id.nil?
|
|
187
188
|
raise(Fbe::Error, 'The ID of the user must be an Integer') unless id.is_a?(Integer)
|
|
@@ -189,6 +190,8 @@ def Fbe.octo(options: $options, global: $global, loog: $loog) # rubocop:disable
|
|
|
189
190
|
name = json[:login].downcase
|
|
190
191
|
@loog.debug("GitHub user ##{id} has a name: @#{name}")
|
|
191
192
|
name
|
|
193
|
+
rescue Octokit::NotFound, Octokit::Forbidden => e
|
|
194
|
+
raise(Fbe::Error, "GitHub user ##{id} is not accessible: #{e.message}")
|
|
192
195
|
end
|
|
193
196
|
def repo_id_by_name(name) # rubocop:disable Layout/EmptyLineBetweenDefs
|
|
194
197
|
raise(Fbe::Error, 'The name of the repo is nil') if name.nil?
|
data/lib/fbe.rb
CHANGED