redis-memo 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c1f9810ab293851487a23911835eb644ce4401df360404a04236898b99e1ab64
4
- data.tar.gz: edbd814f8e8c027207123340445f121e771e30260e7126fb91665a23139fd710
3
+ metadata.gz: 976988ff54686693396ffb07c47b9e4326646837b3be53264891c886f03771c6
4
+ data.tar.gz: 9e4a3d4dca78cb9389af8e1728addb3aa8d04493365bcfda2ea236e20c657971
5
5
  SHA512:
6
- metadata.gz: 2a07892d98f25a3690ee254015be04f0164053be755fcce73478598ba65e28a39a4e99b47d18b12f1ec6e89facfba06e9d1b8390dab61ac3713e291f4451b782
7
- data.tar.gz: 47f5e0d42b7957d6422277f01446b6659f8526371e556957626a68c44635d1ba456380152d48f3682959cbd84f4d2adf333a50697be386f554b000b4edf67d1f
6
+ metadata.gz: 118d801be413e14616becfb3a9c4e4715a1e7b7cb6722ac48bd8b1c63e6b1c8f565c8a148909b4bd7b4b538f89d1d79145ad137403139eb7158cad61c9d7a847
7
+ data.tar.gz: 52bdf762fc8bf22a6b65fc158512e001dd12490904db9766cd9f3ff1aee74e61f23f218bfa46cdf57fdb67f9f0d2508649fedc2379d6224d0d34416ffbafb902
@@ -267,9 +267,6 @@ class RedisMemo::MemoizeQuery::CachedSelect
267
267
 
268
268
  bind_params
269
269
  when Arel::Nodes::SelectStatement
270
- # No OREDER BY
271
- return unless node.orders.empty?
272
-
273
270
  node.cores.each do |core|
274
271
  # We don't support JOINs
275
272
  return unless core.source.right.empty?
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Redis memo can be flaky due to transient network errors (e.g. Redis connection errors), or when
4
+ # used with async handlers. This class allows users to override the default redis-memo behavior
5
+ # to be more robust when testing their code that uses redis-memo.
6
+ module RedisMemo
7
+ class Testing
8
+
9
+ def self.__test_mode
10
+ @__test_mode
11
+ end
12
+
13
+ def self.__test_mode=(mode)
14
+ @__test_mode = mode
15
+ end
16
+
17
+ def self.enable_test_mode(&blk)
18
+ __set_test_mode(true, &blk)
19
+ end
20
+
21
+ def self.disable_test_mode(&blk)
22
+ __set_test_mode(false, &blk)
23
+ end
24
+
25
+ def self.enabled?
26
+ __test_mode
27
+ end
28
+
29
+ private
30
+
31
+ def self.__set_test_mode(mode, &blk)
32
+ if blk.nil?
33
+ __test_mode = mode
34
+ else
35
+ prev_mode = __test_mode
36
+ begin
37
+ __test_mode = mode
38
+ yield
39
+ ensure
40
+ __test_mode = prev_mode
41
+ end
42
+ end
43
+ end
44
+ end
45
+
46
+ module TestOverrides
47
+ def without_memo?
48
+ if RedisMemo::Testing.enabled? && !RedisMemo::Memoizable::Invalidation.class_variable_get(:@@invalidation_queue).empty?
49
+ return true
50
+ end
51
+ super
52
+ end
53
+ end
54
+ singleton_class.prepend(TestOverrides)
55
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-memo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chan Zuckerberg Initiative
@@ -192,6 +192,7 @@ files:
192
192
  - lib/redis_memo/middleware.rb
193
193
  - lib/redis_memo/options.rb
194
194
  - lib/redis_memo/redis.rb
195
+ - lib/redis_memo/testing.rb
195
196
  - lib/redis_memo/tracer.rb
196
197
  homepage: https://github.com/chanzuckerberg/redis-memo
197
198
  licenses: