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: git pubsub was moved and the output changed
Date Sun, 22 Mar 2020 17:55:45 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 ab33176  git pubsub was moved and the output changed
ab33176 is described below

commit ab3317658f0bd5223f76c0856e899877c5d41f92
Author: Sebb <sebb@apache.org>
AuthorDate: Sun Mar 22 17:55:08 2020 +0000

    git pubsub was moved and the output changed
---
 tools/pubsub.rb | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/tools/pubsub.rb b/tools/pubsub.rb
index 131ffe2..1bda926 100644
--- a/tools/pubsub.rb
+++ b/tools/pubsub.rb
@@ -26,7 +26,7 @@ options = OpenStruct.new
 options.remote = 'https://gitbox.apache.org/repos/asf/whimsy.git'
 options.local = '/srv/whimsy'
 options.pidfile = "/var/run/#{script}.pid"
-options.streamURL = 'http://gitpubsub-wip.apache.org:2069/json/*'
+options.streamURL = 'http://pubsub.apache.org:2069/git/'
 options.puppet = false
 # options.streamURL = 'http://svn.apache.org:2069/commits'
 
@@ -117,10 +117,12 @@ end
 # Monitor PubSub endpoint (see http://www.apache.org/dev/gitpubsub.html)
 #
 
+PROJECT = File.basename(options.remote, '.git')
+
 # prime the pump
 restartable = false
 notification_queue = Queue.new
-notification_queue.push 'project' => 'whimsy'
+notification_queue.push 'project' => PROJECT
 
 ps_thread = Thread.new do
   begin
@@ -132,7 +134,8 @@ ps_thread = Thread.new do
       http.request request do |response|
         body = ''
         response.read_body do |chunk|
-          if chunk =~ /\r\n$|\0$/
+          # Looks like the service only sends \n terminators now
+          if chunk =~ /\r?\n$|\0$/
             notification = JSON.parse(body + chunk.chomp("\0"))
             body = ''
 
@@ -167,13 +170,12 @@ end
 #
 # Process queued requests
 #
-project = File.basename(options.remote, '.git')
 
 begin
   mtime = File.mtime(__FILE__)
   while ps_thread.alive?
     notification = notification_queue.pop
-    next unless notification['project'] == project
+    next unless notification['project'] == PROJECT
     notification_queue.clear
 
     if options.puppet


Mime
View raw message