assaf/vanity

Don't throw errors if datastore was not initialised correctly

Closed this issue · 2 comments

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?

Looks like it is our code carelessly treats results returned from Vanity, which could be nil in case of datastore error. Closing issue