Merge branch 'main' into glitch-soc/merge-upstream
commit
3186d2f63e
|
@ -1,6 +1,6 @@
|
||||||
name: Bug Report
|
name: Bug Report
|
||||||
description: If something isn't working as expected
|
description: If something isn't working as expected
|
||||||
labels: bug
|
labels: [bug]
|
||||||
body:
|
body:
|
||||||
- type: markdown
|
- type: markdown
|
||||||
attributes:
|
attributes:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: Feature Request
|
name: Feature Request
|
||||||
description: I have a suggestion
|
description: I have a suggestion
|
||||||
labels: suggestion
|
labels: [suggestion]
|
||||||
body:
|
body:
|
||||||
- type: markdown
|
- type: markdown
|
||||||
attributes:
|
attributes:
|
||||||
|
|
|
@ -57,7 +57,7 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def preload_delivery_failures!
|
def preload_delivery_failures!
|
||||||
warning_domains_map = DeliveryFailureTracker.warning_domains_map
|
warning_domains_map = DeliveryFailureTracker.warning_domains_map(@instances.map(&:domain))
|
||||||
|
|
||||||
@instances.each do |instance|
|
@instances.each do |instance|
|
||||||
instance.failure_days = warning_domains_map[instance.domain]
|
instance.failure_days = warning_domains_map[instance.domain]
|
||||||
|
|
|
@ -65,8 +65,13 @@ class DeliveryFailureTracker
|
||||||
domains - UnavailableDomain.all.pluck(:domain)
|
domains - UnavailableDomain.all.pluck(:domain)
|
||||||
end
|
end
|
||||||
|
|
||||||
def warning_domains_map
|
def warning_domains_map(domains = nil)
|
||||||
warning_domains.index_with { |domain| redis.scard(exhausted_deliveries_key_by(domain)) }
|
if domains.nil?
|
||||||
|
warning_domains.index_with { |domain| redis.scard(exhausted_deliveries_key_by(domain)) }
|
||||||
|
else
|
||||||
|
domains -= UnavailableDomain.where(domain: domains).pluck(:domain)
|
||||||
|
domains.index_with { |domain| redis.scard(exhausted_deliveries_key_by(domain)) }.filter { |_, days| days.positive? }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
Loading…
Reference in New Issue