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/11/03 16:08:34 UTC

[1/2] incubator-ponymail git commit: Use UPPERCASE for constants

Repository: incubator-ponymail
Updated Branches:
  refs/heads/master d39602df6 -> d05bd70a1


Use UPPERCASE for constants

Also replace duplicate defintion of magic IVM key name with constant

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

Branch: refs/heads/master
Commit: dd2e3571dadfd1a49a87caa2227e80537d2b37e6
Parents: d39602d
Author: Sebb <se...@apache.org>
Authored: Thu Nov 3 16:01:59 2016 +0000
Committer: Sebb <se...@apache.org>
Committed: Thu Nov 3 16:01:59 2016 +0000

----------------------------------------------------------------------
 site/api/pminfo.lua | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/dd2e3571/site/api/pminfo.lua
----------------------------------------------------------------------
diff --git a/site/api/pminfo.lua b/site/api/pminfo.lua
index 9935d02..639db64 100644
--- a/site/api/pminfo.lua
+++ b/site/api/pminfo.lua
@@ -32,14 +32,15 @@ function handle(r)
     if #domain < 2 then
         domain = "*"
     end
-    local dd = 14
-    local maxresults = 10000
+    local DD = 14
+    local MAXRESULTS = 10000
     local listdata = {}
 
     
-    local nowish = math.floor(os.time() / 1800)
+    local NOWISH = math.floor(os.time() / 1800)
+    local PMINFO_CACHE_KEY = "pminfo_cache_" .. r.hostname .. "-" .. NOWISH
     
-    local cache = r:ivm_get("pminfo_cache_" ..r.hostname .."-" .. nowish)
+    local cache = r:ivm_get(PMINFO_CACHE_KEY)
     if cache then
         r:puts(cache)
         return cross.OK
@@ -49,7 +50,7 @@ function handle(r)
     table.insert(t, r:clock() - tnow)
     tnow = r:clock()
     
-    local daterange = {gt = "now-"..dd.."d", lt = "now+1d" }
+    local daterange = {gt = "now-"..DD.."d", lt = "now+1d" }
     
     local sterm = {
             wildcard = {
@@ -254,7 +255,7 @@ function handle(r)
                 }
             }  
         },
-        size = maxresults
+        size = MAXRESULTS
     }
     local h = 0
     local maxScrolls = 5
@@ -344,7 +345,7 @@ function handle(r)
     tnow = r:clock()
     
     JSON.encode_max_depth(500)
-    listdata.max = maxresults
+    listdata.max = MAXRESULTS
     listdata.no_threads = #threads
     listdata.hits = h
     listdata.participants = no_senders
@@ -360,7 +361,7 @@ function handle(r)
     
     listdata.debug = t
     local output = JSON.encode(listdata)
-    r:ivm_set("pminfo_cache_" ..r.hostname .."-" .. nowish, output)
+    r:ivm_set(PMINFO_CACHE_KEY, output)
     r:puts(output)
     
     return cross.OK


[2/2] incubator-ponymail git commit: Use constant instead of magic number

Posted by se...@apache.org.
Use constant instead of magic number

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

Branch: refs/heads/master
Commit: d05bd70a1e98e5a4ed645b79ba328268f063d231
Parents: dd2e357
Author: Sebb <se...@apache.org>
Authored: Thu Nov 3 16:08:21 2016 +0000
Committer: Sebb <se...@apache.org>
Committed: Thu Nov 3 16:08:21 2016 +0000

----------------------------------------------------------------------
 site/api/pminfo.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/d05bd70a/site/api/pminfo.lua
----------------------------------------------------------------------
diff --git a/site/api/pminfo.lua b/site/api/pminfo.lua
index 639db64..2f27a14 100644
--- a/site/api/pminfo.lua
+++ b/site/api/pminfo.lua
@@ -82,7 +82,7 @@ function handle(r)
             from = {
                 terms = {
                     field = "list_raw",
-                    size = 10000
+                    size = MAXRESULTS
                 }
             }
         }