You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2016/12/16 14:18:07 UTC

[3/3] incubator-ponymail git commit: pminfo.lua does some unnecessary work

pminfo.lua does some unnecessary work

This fixes #220

Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/bc42f8ef
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/bc42f8ef
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/bc42f8ef

Branch: refs/heads/master
Commit: bc42f8efb34bc71e651811a61718ffab007ca5b8
Parents: 758eee4
Author: Sebb <se...@apache.org>
Authored: Fri Dec 16 14:17:51 2016 +0000
Committer: Sebb <se...@apache.org>
Committed: Fri Dec 16 14:17:51 2016 +0000

----------------------------------------------------------------------
 CHANGELOG.md        |  1 +
 site/api/pminfo.lua | 10 +++-------
 2 files changed, 4 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/bc42f8ef/CHANGELOG.md
----------------------------------------------------------------------
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7204544..37c3941 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -67,6 +67,7 @@
 - typo in all example aaa modules: xemail != exmail (#299)
 - lib/aaa.lua overwrites local customisations on updates (#292)
 - rights checking should be localised (#293)
+- pminfo.lua does some unnecessary work (#220)
 
 ## CHANGES in 0.9b:
 

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/bc42f8ef/site/api/pminfo.lua
----------------------------------------------------------------------
diff --git a/site/api/pminfo.lua b/site/api/pminfo.lua
index 30c1fc3..0d97cac 100644
--- a/site/api/pminfo.lua
+++ b/site/api/pminfo.lua
@@ -164,9 +164,8 @@ function handle(r)
     
     
     -- Get threads
-    local threads = {}
+    local num_threads = 0
     local emails = {}
-    local emls = {}
     local sid = elastic.scan {
         _source = {'message-id','in-reply-to','subject','epoch','references'},
         query = QUERY,
@@ -254,12 +253,9 @@ function handle(r)
                     tid = v._id
                 }
                 emails[mid].nest = emails[irt].nest + 1
-                table.insert(threads, emails[irt])
-            else
-                table.insert(threads, emails[mid])
             end
+            num_threads = num_threads + 1
         end
-        table.insert(emls, email)
     end
     
     -- Debug time point 6
@@ -269,7 +265,7 @@ function handle(r)
     JSON.encode_max_depth(500)
     local listdata = {}
     listdata.max = MAXRESULTS
-    listdata.no_threads = #threads
+    listdata.no_threads = num_threads
     listdata.hits = h
     listdata.participants = no_senders
 --    listdata.top100 = active_senders -- TODO unused by callers?