diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-12-01 11:08:52 +0100 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2022-12-01 11:08:52 +0100 |
commit | fd6f9bf7a75c75ad53c41b4ef0cd059bc5fbf8fc (patch) | |
tree | db438413737f1abf14812e57a65eb9020e74cf7e | |
parent | fc0e11abdb80a9b24fe3ed0a29d0736cc5bfd977 (diff) | |
parent | 491ab8de89017d4dc223f98ae57bbdc23a6fd944 (diff) |
Merge branch 'main' into glitch-soc/merge-upstream
-rw-r--r-- | .github/ISSUE_TEMPLATE/1.bug_report.yml | 2 | ||||
-rw-r--r-- | .github/ISSUE_TEMPLATE/2.feature_request.yml | 2 | ||||
-rw-r--r-- | app/controllers/admin/instances_controller.rb | 2 | ||||
-rw-r--r-- | app/lib/delivery_failure_tracker.rb | 9 |
4 files changed, 10 insertions, 5 deletions
diff --git a/.github/ISSUE_TEMPLATE/1.bug_report.yml b/.github/ISSUE_TEMPLATE/1.bug_report.yml index cdd08d2b0..eb70896d7 100644 --- a/.github/ISSUE_TEMPLATE/1.bug_report.yml +++ b/.github/ISSUE_TEMPLATE/1.bug_report.yml @@ -1,6 +1,6 @@ name: Bug Report description: If something isn't working as expected -labels: bug +labels: [bug] body: - type: markdown attributes: diff --git a/.github/ISSUE_TEMPLATE/2.feature_request.yml b/.github/ISSUE_TEMPLATE/2.feature_request.yml index 6626c2876..2cabcf61e 100644 --- a/.github/ISSUE_TEMPLATE/2.feature_request.yml +++ b/.github/ISSUE_TEMPLATE/2.feature_request.yml @@ -1,6 +1,6 @@ name: Feature Request description: I have a suggestion -labels: suggestion +labels: [suggestion] body: - type: markdown attributes: diff --git a/app/controllers/admin/instances_controller.rb b/app/controllers/admin/instances_controller.rb index 5c82331de..7c44e88b7 100644 --- a/app/controllers/admin/instances_controller.rb +++ b/app/controllers/admin/instances_controller.rb @@ -57,7 +57,7 @@ module Admin end 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| instance.failure_days = warning_domains_map[instance.domain] diff --git a/app/lib/delivery_failure_tracker.rb b/app/lib/delivery_failure_tracker.rb index 7c4e28eb7..66c1fd8c0 100644 --- a/app/lib/delivery_failure_tracker.rb +++ b/app/lib/delivery_failure_tracker.rb @@ -65,8 +65,13 @@ class DeliveryFailureTracker domains - UnavailableDomain.all.pluck(:domain) end - def warning_domains_map - warning_domains.index_with { |domain| redis.scard(exhausted_deliveries_key_by(domain)) } + def warning_domains_map(domains = nil) + 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 private |