redis_data_store_extensions.rb 440 B

1234567891011121314151617
  1. # frozen_string_literal: true
  2. # Restore compatibility with Redis < 6.2
  3. module Stoplight
  4. module DataStore
  5. module RedisExtensions
  6. def query_failures(light, transaction: @redis)
  7. window_start = Time.now.to_i - light.window_size
  8. transaction.zrevrangebyscore(failures_key(light), Float::INFINITY, window_start)
  9. end
  10. end
  11. end
  12. end
  13. Stoplight::DataStore::Redis.prepend(Stoplight::DataStore::RedisExtensions)