lex-synapse 0.4.12 → 0.4.13
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 +4 -0
- data/lib/legion/extensions/synapse/actors/homeostasis.rb +17 -6
- data/lib/legion/extensions/synapse/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: 140dd32d856f6a661d423c72a6f7fcc2424a789342e72d656c25302903d7eda9
|
|
4
|
+
data.tar.gz: 89651542649d74fc871576b608172a4d941cb6b25322a073a54a947458eb369e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c852c9b3dad49309789b63563244983b075a5d13711efd46d3c83118bd0ec49058d7b7a1a9e4279ea0a9445ec3c3184845701b3389e70676960f3fad7fb74f5a
|
|
7
|
+
data.tar.gz: bd6602b930def1ccac2ef61933c659844f959bd219d06267c696143f04802058eda62ccebaa988a45707424b73fd4c2ccdace4207809dabe173c5e61150e11ad
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.4.13] - 2026-05-07
|
|
4
|
+
### Fixed
|
|
5
|
+
- `Homeostasis` actor: replace per-synapse `signals_dataset.count` with a single batched `GROUP BY` query to eliminate N+1 pool contention that caused `Sequel::PoolTimeout` on Postgres
|
|
6
|
+
|
|
3
7
|
## [0.4.12] - 2026-05-07
|
|
4
8
|
### Fixed
|
|
5
9
|
- Added challenge proposal application through the mutate runner so auto-accepted proposals can advance to `applied` and later resolve challenger outcomes.
|
|
@@ -17,13 +17,24 @@ module Legion
|
|
|
17
17
|
results = { spikes: 0, droughts: 0, updated: 0 }
|
|
18
18
|
return results unless defined?(Legion::Extensions::Synapse::Data::Model::Synapse)
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
cutoff = Time.now - 60
|
|
21
|
+
|
|
22
|
+
active_synapses = Legion::Extensions::Synapse::Data::Model::Synapse
|
|
23
|
+
.where(status: 'active')
|
|
24
|
+
.where { baseline_throughput > 0 } # rubocop:disable Style/NumericPredicate
|
|
25
|
+
.all
|
|
26
|
+
|
|
27
|
+
return results if active_synapses.empty?
|
|
28
|
+
|
|
29
|
+
signal_counts = Legion::Extensions::Synapse::Data::Model::SynapseSignal
|
|
30
|
+
.where(synapse_id: active_synapses.map(&:id))
|
|
31
|
+
.where { created_at > cutoff }
|
|
32
|
+
.group_and_count(:synapse_id)
|
|
33
|
+
.as_hash(:synapse_id, :count)
|
|
34
|
+
|
|
35
|
+
active_synapses.each do |synapse|
|
|
24
36
|
baseline = synapse.baseline_throughput
|
|
25
|
-
|
|
26
|
-
current = signals.to_f
|
|
37
|
+
current = signal_counts.fetch(synapse.id, 0).to_f
|
|
27
38
|
|
|
28
39
|
if Helpers::Homeostasis.spike?(current, baseline, duration_seconds: 60)
|
|
29
40
|
results[:spikes] += 1
|