bolshakov / stoplight

:traffic_light: Traffic control for code.
http://bolshakov.github.io/stoplight/
MIT License
384 stars 40 forks source link

Thread safety #92

Closed AndreasWurm closed 8 years ago

AndreasWurm commented 8 years ago

Pull request for issue #87

tfausak commented 8 years ago

This looks good! I'm not sure why the build failed. Doesn't seem like a problem with this branch.

I wonder if the thread-safe data store should be provided as an option, much like the Redis data store. That way I can avoid adding concurrent-ruby as a dependency, and only users that need thread safety have to pay for it. What do you think?

AndreasWurm commented 8 years ago

well, i think thats your decision, only point i would like to raise is to remember the fallback logic, when redis fails, the Light will fallback to use Default::DATA_STORE.

tfausak commented 8 years ago

That's a good point. Can you run the benchmarks against this branch?

tfausak commented 8 years ago

The benchmarks don't test the failure code path, but they run in about the same amount of time as on master.

# master
     creating lambda:  1647203.1 i/s
      calling lambda:  1381496.4 i/s - same-ish: difference falls within error
  creating stoplight:   544997.1 i/s - 3.02x slower
   calling stoplight:   170786.9 i/s - 9.64x slower
# this branch
     creating lambda:  1607600.8 i/s
      calling lambda:  1464719.6 i/s - same-ish: difference falls within error
  creating stoplight:   555682.0 i/s - 2.89x slower
   calling stoplight:   165307.7 i/s - 9.72x slower
tfausak commented 8 years ago

Released in v1.4.0. Thanks!