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 0f6793f8 Add timeout waiting for access to svn log
0f6793f8 is described below
commit 0f6793f8857543629255aeb4f18aed3d27987c8a
Author: Sebb <[email protected]>
AuthorDate: Wed Jul 30 17:09:37 2025 +0100
Add timeout waiting for access to svn log
---
www/status/monitors/svn.rb | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/www/status/monitors/svn.rb b/www/status/monitors/svn.rb
index dcd908b1..d7835bbf 100644
--- a/www/status/monitors/svn.rb
+++ b/www/status/monitors/svn.rb
@@ -14,10 +14,15 @@ Danger - unexpected text in log file
=end
require 'fileutils'
+require 'timeout'
# Match revision messages
REV_RE = %r{^(Checked out|\s*Updated ('[^']+' )?to|At|List updated from \d+
to|List is at) (revision |r)\d+\s*\.$}
+# Allow 3 minute timeout waiting for svn update to finish; may need to be
adjusted
+# It looks like node ping checks every 5 min
+LOCK_TIMEOUT = 180
+
def StatusMonitor.svn(previous_status)
logdir = File.expand_path('../../../logs', __FILE__)
archive = File.join(logdir,'archive')
@@ -29,11 +34,27 @@ def StatusMonitor.svn(previous_status)
fdata = DATA.read
else
log = File.expand_path('../../../logs/svn-update', __FILE__)
- fdata = File.open(log) {|file| file.flock(File::LOCK_EX); file.read}
+ fdata = File.open(log) do |file|
+ begin
+ Timeout::timeout(LOCK_TIMEOUT) do # Apply timeout to lock wait
+ file.flock(File::LOCK_EX)
+ file.read
+ end
+ rescue Timeout::Error => ex
+ ex
+ end
+ end
end
- updates = fdata.split(%r{\n(?:/\w+)*/srv/svn/})[1..-1]
status = {}
+
+ if fdata.is_a? Exception
+ status['*'] = {level: 'warning', data: 'Timed out waiting for svn update
to complete', href: '../logs/svn-update'}
+ return {data: status}
+ end
+
+ updates = fdata.split(%r{\n(?:/\w+)*/srv/svn/})[1..-1] || []
+
seen_level = {}
# extract status for each repository