You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2020/07/21 14:09:32 UTC

[whimsy] branch master updated: Keep track of how many events are not needed

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 6d55d29  Keep track of how many events are not needed
6d55d29 is described below

commit 6d55d2967b8e05069d75c9c4e04c7fc1210db882
Author: Sebb <se...@apache.org>
AuthorDate: Tue Jul 21 15:09:21 2020 +0100

    Keep track of how many events are not needed
---
 tools/pubsub2rake.rb | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/pubsub2rake.rb b/tools/pubsub2rake.rb
index fdc8635..45905e2 100755
--- a/tools/pubsub2rake.rb
+++ b/tools/pubsub2rake.rb
@@ -49,7 +49,6 @@ class PubSub
                   puts(stamp event) if debug
                 else
                   yield event
-                  # code.call event
                 end
               else
                 puts(stamp "Partial chunk") if debug
@@ -94,6 +93,9 @@ end
 if $0 == __FILE__
   $stdout.sync = true
 
+  $hits = 0 # items matched
+  $misses = 0 # items not matched
+
   # Cannot use shift as ARGV is needed for a relaunch
   pubsub_URL = ARGV[0]  || 'https://pubsub.apache.org:2070/svn'
   pubsub_FILE = ARGV[1] || File.join(Dir.home,'.pubsub')
@@ -114,6 +116,7 @@ if $0 == __FILE__
   def process(event)
     path = event['pubsub_path']
     if WATCH.include? path # WATCH auto-vivifies
+      $hits += 1
       matches = Hash.new{|h,k| h[k] = Array.new} # key alias, value = array of matching files
       watching = WATCH[path]
       watching.each do |svn_prefix, svn_alias, files|
@@ -134,12 +137,14 @@ if $0 == __FILE__
         end
       end
       matches.each do |k,v|
-        puts stamp "Updating #{k}"
+        puts stamp "Updating #{k} #{$hits}/#{$misses}"
         cmd = ['rake', "svn:update[#{k}]"]
         unless system(*cmd, {chdir: '/srv/whimsy'})
           puts stamp "Error #{$?} processing #{cmd}"
         end
       end
+    else
+      $misses += 1
     end # possible match
   end