cuboid 0.5.1 → 0.5.2
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/lib/cuboid/rpc/server/scheduler.rb +34 -4
- data/lib/version +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 600130025a98049b1378e4598204ec17e2816095779b2b66f88ce7167a1a647f
|
|
4
|
+
data.tar.gz: b84d8da4ee6844556c043884c3f74f3e7c66992f940bf72d52f0a18784630cfd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 293059b05e93cd107840a6d7985749eaee19d979113ccb58ea98ee1f5738278ce795bef2ef6eea313a7d516bbf6564815195a6a60af20154175feb44170c755e
|
|
7
|
+
data.tar.gz: 4d9555ac474bae2a4f7a6cdc341bddff3406e4b23b71fa685da3d738dc454d5b8f59018996b99963391b26e4b7171c28bc0ee18f23a03ec5da67dd06bfcaebce
|
|
@@ -45,6 +45,13 @@ class Scheduler
|
|
|
45
45
|
|
|
46
46
|
TICK_CONSUME = 0.1
|
|
47
47
|
|
|
48
|
+
# Number of CONSECUTIVE RPC errors a running Instance is allowed to
|
|
49
|
+
# accumulate before it's given up on and marked {#failed}. A single
|
|
50
|
+
# transient blip (the Instance momentarily unreachable on one ping, an
|
|
51
|
+
# engine reconnect, etc.) shouldn't fail an otherwise-healthy scan; any
|
|
52
|
+
# clean response in between resets the count.
|
|
53
|
+
RPC_ERROR_TOLERANCE = 5
|
|
54
|
+
|
|
48
55
|
def initialize
|
|
49
56
|
@options = Options.instance
|
|
50
57
|
|
|
@@ -62,9 +69,11 @@ class Scheduler
|
|
|
62
69
|
@id_to_priority = {}
|
|
63
70
|
@by_priority = {}
|
|
64
71
|
|
|
65
|
-
@running
|
|
66
|
-
@completed
|
|
67
|
-
@failed
|
|
72
|
+
@running = {}
|
|
73
|
+
@completed = {}
|
|
74
|
+
@failed = {}
|
|
75
|
+
# Per-Instance consecutive RPC-error counters (see RPC_ERROR_TOLERANCE).
|
|
76
|
+
@rpc_error_counts = Hash.new( 0 )
|
|
68
77
|
|
|
69
78
|
set_handlers( @server )
|
|
70
79
|
trap_interrupts { Thread.new { shutdown } }
|
|
@@ -335,17 +344,37 @@ class Scheduler
|
|
|
335
344
|
handle_rpc_error( id, busy )
|
|
336
345
|
block.call
|
|
337
346
|
elsif busy
|
|
347
|
+
# Clean response — the Instance is reachable and working, so
|
|
348
|
+
# reset its consecutive-error tolerance.
|
|
349
|
+
@rpc_error_counts.delete( id )
|
|
338
350
|
print_debug "[#{id}] Busy."
|
|
339
351
|
block.call
|
|
340
352
|
else
|
|
353
|
+
# Don't reset here: this leads to the report grab, whose own
|
|
354
|
+
# transient errors must be allowed to accumulate toward the
|
|
355
|
+
# tolerance rather than being cleared every ping.
|
|
341
356
|
get_report_and_shutdown( id, client, &block )
|
|
342
357
|
end
|
|
343
358
|
end
|
|
344
359
|
end
|
|
345
360
|
|
|
346
361
|
def handle_rpc_error( id, error )
|
|
347
|
-
|
|
362
|
+
@rpc_error_counts[id] += 1
|
|
363
|
+
count = @rpc_error_counts[id]
|
|
364
|
+
|
|
365
|
+
# Tolerate transient errors — only give up after RPC_ERROR_TOLERANCE
|
|
366
|
+
# of them in a row. The Instance stays in @running and gets re-checked
|
|
367
|
+
# on the next ping; a clean response resets the count.
|
|
368
|
+
if count < RPC_ERROR_TOLERANCE
|
|
369
|
+
print_error "[#{id}] RPC error #{count}/#{RPC_ERROR_TOLERANCE} " \
|
|
370
|
+
"(tolerating): [#{error.class}] #{error}"
|
|
371
|
+
return
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
print_error "[#{id}] Failed after #{count} consecutive RPC errors: " \
|
|
375
|
+
"[#{error.class}] #{error}"
|
|
348
376
|
|
|
377
|
+
@rpc_error_counts.delete( id )
|
|
349
378
|
@failed[id] = {
|
|
350
379
|
error: error.class.to_s,
|
|
351
380
|
description: error.to_s
|
|
@@ -371,6 +400,7 @@ class Scheduler
|
|
|
371
400
|
client.shutdown do
|
|
372
401
|
print_status "[#{id}] Completed."
|
|
373
402
|
|
|
403
|
+
@rpc_error_counts.delete( id )
|
|
374
404
|
@running.delete( id ).close
|
|
375
405
|
@completed[id] = path
|
|
376
406
|
|
data/lib/version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.5.
|
|
1
|
+
0.5.2
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cuboid
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tasos Laskos
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-06-
|
|
11
|
+
date: 2026-06-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: awesome_print
|