Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id E4F6B200BF9 for ; Sun, 8 Jan 2017 13:23:04 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id E38B7160B36; Sun, 8 Jan 2017 12:23:04 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 3AB01160B2C for ; Sun, 8 Jan 2017 13:23:04 +0100 (CET) Received: (qmail 21708 invoked by uid 500); 8 Jan 2017 12:23:03 -0000 Mailing-List: contact commits-help@ponymail.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ponymail.incubator.apache.org Delivered-To: mailing list commits@ponymail.incubator.apache.org Received: (qmail 21699 invoked by uid 99); 8 Jan 2017 12:23:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 Jan 2017 12:23:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id C685D1A06B3 for ; Sun, 8 Jan 2017 12:23:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -6.219 X-Spam-Level: X-Spam-Status: No, score=-6.219 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id BDBfXA9Sf6nr for ; Sun, 8 Jan 2017 12:23:01 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id BBD645F1BA for ; Sun, 8 Jan 2017 12:23:00 +0000 (UTC) Received: (qmail 21675 invoked by uid 99); 8 Jan 2017 12:22:59 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 Jan 2017 12:22:59 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C63B5DFA0E; Sun, 8 Jan 2017 12:22:59 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sebb@apache.org To: commits@ponymail.incubator.apache.org Message-Id: <2b989456655d42499fad33c8cb023f0b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: incubator-ponymail git commit: stats.lua updates senders array unnecessarily in statsOnly (quick) mode Date: Sun, 8 Jan 2017 12:22:59 +0000 (UTC) archived-at: Sun, 08 Jan 2017 12:23:05 -0000 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 Authored: Sun Jan 8 12:22:51 2017 +0000 Committer: Sebb 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