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 2017/01/08 12:22:59 UTC
incubator-ponymail git commit: stats.lua updates senders array
unnecessarily in statsOnly (quick) mode
Repository: incubator-ponymail
Updated Branches:
refs/heads/master 722589df5 -> febc83739
stats.lua updates senders array unnecessarily in statsOnly (quick) mode
This fixes #330
Also localised eml variable
Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/febc8373
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/febc8373
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/febc8373
Branch: refs/heads/master
Commit: febc83739d3cf5f22c5f4720aa0fc0f3e09ab9a7
Parents: 722589d
Author: Sebb <se...@apache.org>
Authored: Sun Jan 8 12:22:51 2017 +0000
Committer: Sebb <se...@apache.org>
Committed: Sun Jan 8 12:22:51 2017 +0000
----------------------------------------------------------------------
CHANGELOG.md | 1 +
site/api/stats.lua | 18 ++++++++++--------
2 files changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/febc8373/CHANGELOG.md
----------------------------------------------------------------------
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3e5ab70..f88077d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -111,6 +111,7 @@
- setup.py now prompts for shard and replica counts when creating the index (#313)
- 'hot topics' feature should use terms, not significant_terms (#329)
- stats.lua - slow_count option is unnecessary (#323)
+- stats.lua updates senders array unnecessarily in statsOnly (quick) mode (#330)
## CHANGES in 0.9b:
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/febc8373/site/api/stats.lua
----------------------------------------------------------------------
diff --git a/site/api/stats.lua b/site/api/stats.lua
index 117a0ee..9be94d7 100644
--- a/site/api/stats.lua
+++ b/site/api/stats.lua
@@ -533,23 +533,25 @@ function handle(r)
if eepoch > lastEmail then
lastEmail = eepoch
end
- local eml = utils.extractCanonEmail(email.from)
if aaa.canAccessDoc(r, email, account) then
h = h + 1
+ local eml = utils.extractCanonEmail(email.from)
local gravatar = r:md5(eml:lower())
email.gravatar = gravatar
local name = extractCanonName(email.from)
local eid = ("%s <%s>"):format(name, eml)
- senders[eid] = senders[eid] or {
- email = eml,
- gravatar = gravatar,
- name = name,
- count = 0
- }
- senders[eid].count = senders[eid].count + 1
+ if not statsOnly then
+ senders[eid] = senders[eid] or {
+ email = eml,
+ gravatar = gravatar,
+ name = name,
+ count = 0
+ }
+ senders[eid].count = senders[eid].count + 1
+ end
local mid = email['message-id']
local irt = email['in-reply-to']
email.id = v._id