ponymail-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [1/2] incubator-ponymail git commit: Use UPPERCASE for constants
Date Thu, 03 Nov 2016 16:08:34 GMT
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 <sebb@apache.org>
Authored: Thu Nov 3 16:01:59 2016 +0000
Committer: Sebb <sebb@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


Mime
View raw message