whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [whimsy] branch master updated: Pre-freeze before caching
Date Mon, 24 May 2021 22:59:02 GMT
This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new b012789  Pre-freeze before caching
b012789 is described below

commit b012789cd5c7e18bc0b7c61a25eb3d91101e5a87
Author: Sebb <sebb@apache.org>
AuthorDate: Mon May 24 23:58:52 2021 +0100

    Pre-freeze before caching
---
 lib/whimsy/asf/mlist.rb | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/lib/whimsy/asf/mlist.rb b/lib/whimsy/asf/mlist.rb
index 96b724d..f4050bd 100644
--- a/lib/whimsy/asf/mlist.rb
+++ b/lib/whimsy/asf/mlist.rb
@@ -348,8 +348,7 @@ module ASF
         if cached
           begin
             cached.each do |d, l, m|
-              # don't allow cache to be altered
-              yield d.freeze, l.freeze, m.freeze
+              yield d, l, m # these are already frozen
             end
             return
           rescue WeakRef::RefError
@@ -368,13 +367,12 @@ module ASF
         # or    [/home/apmail/lists/]apachecon.com/announce[/mod]
         match = stanza.match(%r{(?:^|/)([-\w]*\.?apache\.org|apachecon\.com)/(.*?)#{suffix}(?:\n|\Z)})
         if match
-          dom = match[1].downcase # just in case
-          list = match[2].downcase # just in case
+          dom = match[1].downcase.freeze # just in case
+          list = match[2].downcase.freeze # just in case
           # Keep original case of email addresses
-          mails = stanza.split(/\n/).select {|x| x =~ /@/}
+          mails = stanza.split(/\n/).select {|x| x =~ /@/}.freeze
           cache << [dom, list, mails]
-          # don't allow cache to be altered
-          yield dom.freeze, list.freeze, mails.freeze
+          yield dom, list, mails
         else
           # don't allow mismatches as that means the RE is wrong
           line = stanza[0..(stanza.index("\n") || -1)]

Mime
View raw message