summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2013-04-25 12:14:32 +0200
committerChristoph Helma <helma@in-silico.ch>2013-04-25 12:14:32 +0200
commit4fe9d9e1d0fdf88a19b5c63c14074e0688505704 (patch)
tree797e7b094962b6533387cfee7410a3af8ff08781
parentb821314a7b55b05d557209ce1c3b98603f094476 (diff)
retries for 4store errors during sparql updates
-rw-r--r--lib/4store.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/4store.rb b/lib/4store.rb
index d03a38e..4240879 100644
--- a/lib/4store.rb
+++ b/lib/4store.rb
@@ -44,9 +44,18 @@ module OpenTox
end
def self.update sparql
- RestClient.post(update_uri, :update => sparql )
- rescue
- bad_request_error $!.message, update_uri
+ attempts = 0
+ begin
+ attempts += 1
+ RestClient.post(update_uri, :update => sparql )
+ rescue
+ if attempts < 4 # 4store may return errors under heavy load
+ sleep 1
+ retry
+ else
+ bad_request_error $!.message, update_uri
+ end
+ end
end
def self.query sparql, mime_type