Skip to content

Commit

Permalink
so we could retry
Browse files Browse the repository at this point in the history
  • Loading branch information
godfat committed Dec 2, 2014
1 parent 38f1f6d commit 1019df8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ f = RestFirebase.new :site => 'https://SampleChat.firebaseIO-demo.com/',
:secret => 'secret',
:d => {:auth_data => 'something'},
:log_method => method(:puts),
# `timeout` in seconds
:timeout => 10,
# `max_retries` upon failures
:max_retries => 3,
# `retry_exceptions` for which exceptions should retry
# Default is: `[IOError, SystemCallError]`
:retry_exceptions =>
[IOError, SystemCallError, Timeout::Error],
# `auth_ttl` describes when we should refresh the auth
# token. Set it to `false` to disable auto-refreshing.
# The default is 23 hours.
Expand Down
6 changes: 3 additions & 3 deletions lib/rest-firebase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
# https://www.firebase.com/docs/rest-api.html
# https://www.firebase.com/docs/rest/guide/retrieving-data.html#section-rest-queries
RestFirebase = RC::Builder.client(:d, :secret, :auth, :auth_ttl, :iat) do
use RC::Timeout , 10

use RC::DefaultSite , 'https://SampleChat.firebaseIO-demo.com/'
use RC::DefaultHeaders, {'Accept' => 'application/json',
'Content-Type' => 'application/json'}
use RC::DefaultQuery , nil

use RC::Retry , 0, RC::Retry::DefaultRetryExceptions
use RC::Timeout , 10
use RC::FollowRedirect, 1
use RC::CommonLogger , nil
use RC::ErrorHandler , lambda{ |env| RestFirebase::Error.call(env) }
use RC::ErrorDetectorHttp
use RC::JsonRequest , true
use RC::JsonResponse , true
use RC::CommonLogger , nil
use RC::Cache , nil, 600
end

Expand Down

0 comments on commit 1019df8

Please sign in to comment.