legionio 1.4.113 → 1.4.114
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/CHANGELOG.md +7 -0
- data/lib/legion/extensions.rb +34 -10
- data/lib/legion/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: '033549b7666e088a8ac6fae313d91767f35c04a607ba20feca1726a5090cc828'
|
|
4
|
+
data.tar.gz: 5020e3bbfb01cc909730d239ce80236b6ba787ea56b9329dd8872047e84ffd9f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bb44c0c2f7f6545a26df93eb103c0876f7786256b19d6354c5b6268f3df34696925afd2225535260f862dba3475f797fd027f073609785af985b9d87e9abb011
|
|
7
|
+
data.tar.gz: ad9f7cc79fa61dc15c304e29daf07953b8a63f87dbe78e0f438d68c82c1bcb030fafbf8ced1facb18dd668857544b7637fcd736a8a23ccf52ad0a54d273c17ee
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Legion Changelog
|
|
2
2
|
|
|
3
|
+
## [1.4.114] - 2026-03-22
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
- Parallelize extension loading using Concurrent::Promises thread pool (4 workers)
|
|
7
|
+
- Use Concurrent::Array for thread-safe pending_actors during parallel load
|
|
8
|
+
- ~4x faster boot: extensions load concurrently instead of serially
|
|
9
|
+
|
|
3
10
|
## [1.4.112] - 2026-03-21
|
|
4
11
|
|
|
5
12
|
### Added
|
data/lib/legion/extensions.rb
CHANGED
|
@@ -20,7 +20,7 @@ module Legion
|
|
|
20
20
|
@subscription_tasks = []
|
|
21
21
|
@local_tasks = []
|
|
22
22
|
@actors = []
|
|
23
|
-
@pending_actors =
|
|
23
|
+
@pending_actors = Concurrent::Array.new
|
|
24
24
|
|
|
25
25
|
find_extensions
|
|
26
26
|
load_extensions
|
|
@@ -52,7 +52,8 @@ module Legion
|
|
|
52
52
|
def load_extensions
|
|
53
53
|
@extensions ||= []
|
|
54
54
|
@loaded_extensions ||= []
|
|
55
|
-
|
|
55
|
+
|
|
56
|
+
eligible = @extensions.filter_map do |entry|
|
|
56
57
|
gem_name = entry[:gem_name]
|
|
57
58
|
ext_name = entry[:require_path].split('/').last
|
|
58
59
|
|
|
@@ -65,14 +66,11 @@ module Legion
|
|
|
65
66
|
end
|
|
66
67
|
|
|
67
68
|
Catalog.register(gem_name)
|
|
68
|
-
|
|
69
|
-
Legion::Logging.warn("#{gem_name} failed to load")
|
|
70
|
-
next
|
|
71
|
-
end
|
|
72
|
-
Catalog.transition(gem_name, :loaded)
|
|
73
|
-
register_in_registry(gem_name: gem_name, version: entry[:version])
|
|
74
|
-
@loaded_extensions.push(gem_name)
|
|
69
|
+
entry
|
|
75
70
|
end
|
|
71
|
+
|
|
72
|
+
load_extensions_parallel(eligible)
|
|
73
|
+
|
|
76
74
|
Legion::Logging.info(
|
|
77
75
|
"#{@extensions.count} extensions loaded with " \
|
|
78
76
|
"subscription:#{@subscription_tasks.count}," \
|
|
@@ -83,6 +81,32 @@ module Legion
|
|
|
83
81
|
)
|
|
84
82
|
end
|
|
85
83
|
|
|
84
|
+
def load_extensions_parallel(eligible)
|
|
85
|
+
return if eligible.empty?
|
|
86
|
+
|
|
87
|
+
pool_size = [4, eligible.count].min
|
|
88
|
+
executor = Concurrent::FixedThreadPool.new(pool_size)
|
|
89
|
+
|
|
90
|
+
futures = eligible.map do |entry|
|
|
91
|
+
Concurrent::Promises.future_on(executor, entry) { |e| load_extension(e) ? e : nil }
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
results = futures.map(&:value)
|
|
95
|
+
|
|
96
|
+
executor.shutdown
|
|
97
|
+
executor.wait_for_termination(30)
|
|
98
|
+
|
|
99
|
+
results.each_with_index do |result, idx|
|
|
100
|
+
if result
|
|
101
|
+
Catalog.transition(result[:gem_name], :loaded)
|
|
102
|
+
register_in_registry(gem_name: result[:gem_name], version: result[:version])
|
|
103
|
+
@loaded_extensions.push(result[:gem_name])
|
|
104
|
+
else
|
|
105
|
+
Legion::Logging.warn("#{eligible[idx][:gem_name]} failed to load")
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
86
110
|
def load_extension(entry) # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/MethodLength
|
|
87
111
|
ensure_namespace(entry[:const_path]) if entry[:segments].length > 1
|
|
88
112
|
return unless gem_load(entry)
|
|
@@ -177,7 +201,7 @@ module Legion
|
|
|
177
201
|
|
|
178
202
|
Legion::Logging.info "Hooking #{@pending_actors.size} deferred actors"
|
|
179
203
|
@pending_actors.each { |actor| hook_actor(**actor) }
|
|
180
|
-
@pending_actors
|
|
204
|
+
@pending_actors.clear
|
|
181
205
|
Legion::Logging.info(
|
|
182
206
|
"Actors hooked: subscription:#{@subscription_tasks.count}," \
|
|
183
207
|
"every:#{@timer_tasks.count}," \
|
data/lib/legion/version.rb
CHANGED