orgsync/stoplight — pull request #52 by tfausak (2014-09-16 16:03:25+00:00)
Title: Re #6; fall back to in-memory data store

:warning: Do not merge!

Before:

``` irb
>> Stoplight.data_store = Stoplight::DataStore::Redis.new(Redis.new)
=> #
>> light = Stoplight::Light.new('light') { true }
=> #
>> light.run
Redis::TimeoutError: Redis::TimeoutError
```

After:

``` irb
>> Stoplight.data_store = Stoplight::DataStore::Redis.new(Redis.new)
=> #
>> light = Stoplight::Light.new('light') { true }
=> #
>> light.run
Redis::TimeoutError
=> true
```

This is an extremely rough cut of what it might look like to fall back to a different data store. There are a couple problems here:

- I'm catching all errors in `Light#sync` when I probably just want to catch `Redis::TimeoutError`.
- `DataStore#sync` should probably be responsible for wrapping errors in some other class.
- If the in-memory data store itself fails for some reason, this basically does nothing.
- If something other than `#sync` fails, this doesn't do anything.