Don't throw errors if datastore was not initialised correctly
Closed this issue · 2 comments
kirhgoff commented
We are trying to make our service (which uses Vanity) to work in case Redis storage is down. We added initializer to catch datastore errors:
Vanity.configure do |config|
config.failover_on_datastore_error = true
config.on_datastore_error = Proc.new do |error, klass, method, arguments|
Rails.logger.error("Vanity error: #{error} called by #{klass.inspect}, method #{method.inspect} with arguments #{arguments}")
end
end
and it does catch the errors, though application still experiences 500 errors because lines of code like:
Vanity.playground.participant_info(vanity_identity)
still throw errors.
We tried to use method Vanity.playground.connected?
to check for Vanity state, but it returns true even if datastore errors were reported before the call.
What is a recommended method to use Vanity that it is silent if datastore error has happened? How to check that Vanity is not backed by datastore and cannot be used?
phillbaker commented
Hm, the Redis adapter does wrap calls to catch exceptions. What version of
Vanity are you using? Can you post a stack trace of an exception?
…On Thu, Jun 8, 2017 at 11:41 PM Kirill Lastovirya ***@***.***> wrote:
We are trying to make our service (which uses Vanity) to work in case
Redis storage is down. We added initializer to catch datastore errors:
Vanity.configure do |config|
config.failover_on_datastore_error = true
config.on_datastore_error = Proc.new do |error, klass, method, arguments|
Rails.logger.error("Vanity error: #{error} called by #{klass.inspect}, method #{method.inspect} with arguments #{arguments}")
endend
and it does catch the errors, though application still experiences 500
errors because lines of code like:
Vanity.playground.participant_info(vanity_identity)
still throw errors.
We tried to use method Vanity.playground.connected? to check for Vanity
state, but it returns true even if datastore errors were reported before
the call.
What is a recommended method to use Vanity that it is silent if datastore
error has happened? How to check that Vanity is not backed by datastore and
cannot be used?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#325>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAFxKUvkFjhf1IHkRF6W1fgI2d0yL5Lmks5sCL7dgaJpZM4N03ow>
.
kirhgoff commented
Looks like it is our code carelessly treats results returned from Vanity, which could be nil in case of datastore error. Closing issue