You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2016/04/10 19:18:39 UTC
[whimsy] branch master updated: only retry if a commit actually
failed
This is an automated email from the ASF dual-hosted git repository.
rubys pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new 6a78b89 only retry if a commit actually failed
6a78b89 is described below
commit 6a78b89693330aba8897a0797ada5346ae9f2f0c
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Sun Apr 10 13:18:19 2016 -0400
only retry if a commit actually failed
---
www/board/agenda/models/agenda.rb | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/www/board/agenda/models/agenda.rb b/www/board/agenda/models/agenda.rb
index 9f2db81..ff9f44c 100755
--- a/www/board/agenda/models/agenda.rb
+++ b/www/board/agenda/models/agenda.rb
@@ -80,7 +80,7 @@ class Agenda
# update agenda file in SVN
def self.update(file, message, retries=20, &block)
- commit_rc = (message ? 999 : 0)
+ commit_rc = 0
# Create a temporary work directory
dir = Dir.mktmpdir
@@ -122,15 +122,13 @@ class Agenda
IO.write(path, output)
commit_rc = _.system ['svn', 'commit', auth, path, '-m', message]
@@seen[path] = File.mtime(path)
- else
- commit_rc = 0
end
else
output = IO.read(path)
end
- # update the work file, and optionally the cache, if successful
if commit_rc == 0
+ # update the work file, and optionally the cache, if successful
work_file.rewind
if output != baseline
@@ -141,6 +139,14 @@ class Agenda
end
work_file.truncate(work_file.pos)
+ else
+ # if not successful, retry
+ if retries > 0
+ sleep rand(41-retries*2)*0.1 if retries <= 20
+ update(file, message, retries-1, &block)
+ else
+ raise Exception.new("svn commit failed")
+ end
end
# return the result in the response
@@ -150,15 +156,6 @@ class Agenda
ensure
FileUtils.rm_rf dir
-
- unless commit_rc == 0
- if retries > 0
- sleep rand(41-retries*2)*0.1 if retries <= 20
- update(file, message, retries-1, &block)
- else
- raise Exception.new("svn commit failed")
- end
- end
end
# listen for changes to agenda files
--
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].