entitlements-app 1.2.4 → 1.2.6
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/entitlements.rb +28 -10
- data/lib/version.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: 739d6fcd34da1ba6e5af155386469c9192546338cb3ce5a7e3aa56b34979eac7
|
|
4
|
+
data.tar.gz: a14101ee81be9f88732c42119563beb3cea0e2e01b59280f2f6ad4344f0e0392
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e4090f203171ab34ca7aff65e37d036e3b10b604b86a03d8dfb01c1373e18e6e05434fd6fee6a54cf79065e5c6568320b703c3784f112cf0313183ac7d869ee7
|
|
7
|
+
data.tar.gz: fe95f3cc1ef013e6d5fe91249f17a16878bfb780c70356cd6bbdefb56a18857f9a2a007907fb3b96746c7757888e314dfcbbb98d04243d01ef43e11a33e12d3f
|
data/lib/entitlements.rb
CHANGED
|
@@ -22,6 +22,7 @@ require "logger"
|
|
|
22
22
|
require "ostruct"
|
|
23
23
|
require "resolv"
|
|
24
24
|
require "stringio"
|
|
25
|
+
require "thread"
|
|
25
26
|
require "uri"
|
|
26
27
|
require "yaml"
|
|
27
28
|
|
|
@@ -457,25 +458,41 @@ module Entitlements
|
|
|
457
458
|
# Calculate old and new membership in each group.
|
|
458
459
|
thread_pool = Concurrent::FixedThreadPool.new(max_parallelism)
|
|
459
460
|
logger.debug("Begin prefetch and validate for all groups")
|
|
461
|
+
|
|
460
462
|
prep_start = Time.now
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
463
|
+
jobs = Entitlements.child_classes
|
|
464
|
+
completions = Queue.new
|
|
465
|
+
|
|
466
|
+
begin
|
|
467
|
+
jobs.each do |group_name, obj|
|
|
468
|
+
thread_pool.post do
|
|
469
|
+
group_start = Time.now
|
|
470
|
+
logger.debug("Begin prefetch and validate for #{group_name}")
|
|
471
|
+
provider = Entitlements.config["groups"].fetch(group_name).fetch("type")
|
|
472
|
+
timed_operation(phase: "prefetch", provider: provider, target: group_name, concurrent: true) { obj.prefetch }
|
|
473
|
+
timed_operation(phase: "validate", provider: provider, target: group_name, concurrent: true) { obj.validate }
|
|
474
|
+
logger.debug("Finished prefetch and validate for #{group_name} in #{Time.now - group_start}")
|
|
475
|
+
completions << nil
|
|
476
|
+
rescue => e
|
|
477
|
+
completions << e
|
|
478
|
+
end
|
|
469
479
|
end
|
|
470
|
-
end
|
|
471
480
|
|
|
472
|
-
|
|
481
|
+
jobs.size.times do
|
|
482
|
+
exception = completions.pop
|
|
483
|
+
raise exception if exception
|
|
484
|
+
end
|
|
485
|
+
ensure
|
|
486
|
+
thread_pool.kill
|
|
487
|
+
end
|
|
473
488
|
logger.debug("Finished all prefetch and validate in #{Time.now - prep_start}")
|
|
474
489
|
|
|
475
490
|
logger.debug("Begin all calculations")
|
|
476
491
|
calc_start = Time.now
|
|
477
492
|
actions = []
|
|
478
493
|
Entitlements.child_classes.map do |group_name, obj|
|
|
494
|
+
group_start = Time.now
|
|
495
|
+
logger.debug("Begin calculation for #{group_name}")
|
|
479
496
|
provider = Entitlements.config["groups"].fetch(group_name).fetch("type")
|
|
480
497
|
timed_operation(phase: "calculate", provider: provider, target: group_name) { obj.calculate }
|
|
481
498
|
if obj.change_count > 0
|
|
@@ -483,6 +500,7 @@ module Entitlements
|
|
|
483
500
|
cache[:change_count] += obj.change_count
|
|
484
501
|
end
|
|
485
502
|
actions.concat(obj.actions)
|
|
503
|
+
logger.debug("Finished calculation for #{group_name} in #{Time.now - group_start}")
|
|
486
504
|
end
|
|
487
505
|
logger.debug("Finished all calculations in #{Time.now - calc_start}")
|
|
488
506
|
logger.debug("Finished all prefetch, validate, and calculation in #{Time.now - prep_start}")
|
data/lib/version.rb
CHANGED