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 559f3b43 Add some more debug
559f3b43 is described below
commit 559f3b4318e4e944b4b2a8b8d2e84e4b54171e96
Author: Sebb <[email protected]>
AuthorDate: Tue Jun 24 21:46:41 2025 +0100
Add some more debug
---
tools/pubsub.rb | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/tools/pubsub.rb b/tools/pubsub.rb
index 30c09d61..9afe4134 100644
--- a/tools/pubsub.rb
+++ b/tools/pubsub.rb
@@ -15,7 +15,8 @@ require 'json'
require 'fileutils'
def stamp(*s)
- '%s: %s' % [Time.now.gmtime.to_s, s.join(' ')]
+ line = caller[0].split(':')[1]
+ '%s: @%s %s' % [Time.now.gmtime.to_s, line, s.join(' ')]
end
# extract script name
@@ -135,6 +136,8 @@ end
PROJECT = File.basename(options.remote, '.git')
+ALIVE = File.join('/tmp', "#{File.basename(__FILE__)}.alive") # Help detect
failures
+
# prime the pump
restartable = false
notification_queue = Queue.new
@@ -155,6 +158,7 @@ ps_thread = Thread.new do
notification = JSON.parse(body + chunk.chomp("\0"))
body = ''
+ FileUtils.touch(ALIVE)
if notification['stillalive']
restartable = true
elsif notification['push']
@@ -225,15 +229,18 @@ begin
end
end
end
- break if mtime != File.mtime(__FILE__)
+ if mtime != File.mtime(__FILE__) # we have been updated
+ STDERR.puts stamp 'Detected self update'
+ break
+ end
end
rescue SignalException => e
- STDERR.puts stamp e
+ STDERR.puts stamp e.inspect
restartable = false
rescue Exception => e
+ STDERR.puts stamp e
+ STDERR.puts stamp e.backtrace
if ps_thread.alive?
- STDERR.puts stamp e
- STDERR.puts stamp e.backtrace
restartable = false
end
end
@@ -248,4 +255,6 @@ if restartable
# relaunch script after a one second delay
sleep 1
exec RbConfig.ruby, __FILE__, *ARGV
+else
+ STDERR.puts stamp 'not restartable'
end