This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 49ef3f1  Speed up by pre-processing the lists
49ef3f1 is described below

commit 49ef3f1208204c47c41613bf162d2856d2bdd6f9
Author: Sebb <[email protected]>
AuthorDate: Tue May 25 00:02:25 2021 +0100

    Speed up by pre-processing the lists
---
 www/secretary/ldap-check.cgi | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/www/secretary/ldap-check.cgi b/www/secretary/ldap-check.cgi
index 1827d7d..261de4a 100755
--- a/www/secretary/ldap-check.cgi
+++ b/www/secretary/ldap-check.cgi
@@ -38,6 +38,17 @@ _html do
   new = ASF::Committer.listids
   people = ASF::Person.preload(%w(uid createTimestamp asf-banned asf-altEmail 
mail loginShell))
 
+  # fetch the email details up front to avoid rescanning
+  modded = Hash.new{ |h,k| h[k] = Array.new}
+  ASF::MLIST.list_parse('mod') do |dom,list,mods|
+    mods.each {|mod| modded[mod] << [list,dom].join('@')}
+  end
+
+  subbed = Hash.new{ |h,k| h[k] = Array.new}
+  ASF::MLIST.list_parse('sub') do |dom,list,subs|
+    subs.each {|sub| subbed[sub] << [list,dom].join('@')}
+  end
+
   _h2 'members and owners'
 
   _p do
@@ -153,11 +164,10 @@ _html do
           end
           all_mail = p.all_mail
           _td do
-            # keep only the list names
-            _ ASF::MLIST.subscriptions(all_mail)[:subscriptions].map{|x| x[0]}
+            _ subbed.select{|k| all_mail.include? k }.map{|k,v| v}.flatten
           end
           _td do
-            _ ASF::MLIST.moderates(all_mail)[:moderates]
+            _ modded.select{|k| all_mail.include? k }.map{|k,v| v}.flatten
           end
         end
       end

Reply via email to