forget-me-not 0.3.2.1 → 0.3.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZTExZjc2Zjk2OWUzNWJjODVmOWU1MTM2MWUzMzJkNjk0YTIyYTNiMQ==
4
+ MWQ5ODI0Njg4OGM5NmEyN2Y1YWE0Njg3Njc5ODEyMTYyNjJkMjg4Yg==
5
5
  data.tar.gz: !binary |-
6
- ZTEwNTAwMDA3OWE1NTM3NWMwYzM4MTIwZTEwZTU4ZWQwY2FlZjljMA==
6
+ OGZkMGZjMWExMWFjNDQyZjM5NjhjMzFiZmM4MzhiMDY3MjY0Njc1NQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MjE4NjNmOGMyNTI0MmFjZWYzYjJjNzczYjFlZTc4YzM0ZGQyNjI4MjI4NzJk
10
- ZWZlMjdlOTk4MzMyMTgwZGY0M2RkODcwYjZlZGI2MjRmZjNiM2E2OGYyMDli
11
- ZTNlZmMwYmYwYTI2ZTgyYzkzYjZjOGIwOGVlNzMxZGZlZWQ1Zjc=
9
+ Y2Q2ODU1N2QzZGZjZWIxOGQ1YWQ0N2ZiYTVhNGVmMDllODNiZmU5ZjNkOTM4
10
+ ZGU4YTI1ZjhiNTdiYzBmNDk2NDNkYzE4MzA0ZDFiOGQ5MWEwNTE3NzY4NDRi
11
+ YWEwYmVjMzhlZGJmMmFhNTJjOGQ4ODFhYjRlZDFmNDM1MmE2MjE=
12
12
  data.tar.gz: !binary |-
13
- N2RjYzY2YWY3YWRlZGU2MmE1MDRmZTA5MjBjY2NmYWY3NDA1Mjg5MWU0MGM3
14
- NzkwYWQ5MjkwMGM4NDE5ODkyZWFhYmVlYjI1MzFiOTllNWYxZTI4NzcyYmZk
15
- YzhiNDdlM2RkYzQ4ZTY1NDI2OGQwNDJhYmI4ZTI4YjUxMGFmOTc=
13
+ ODFkMTlkZjZlZGZiYmExNzAyYWE5MGY3MDMwOWI5YWIxMjYxZWJkNTQ1YjA0
14
+ M2EyNzg3NDAzOGQ0OGY3ZWNmNzc1ODEzZTc2MTJiNTM4MzBkNDc0YTE5YTQy
15
+ MDZjNWY4ZjQ4N2E3Y2FmMjNhODcyYzc0YmYzZDUxZTk0MDM2YTc=
@@ -119,7 +119,14 @@ module ForgetMeNot
119
119
  def self.warm(*args)
120
120
  begin
121
121
  Cacheable.cache_options_threaded = {force: true}
122
- Cacheable.cachers_and_descendants.each { |cacher| cacher.cache_warm(*args) }
122
+
123
+ Cacheable.cachers_and_descendants.each do |cacher|
124
+ begin
125
+ cacher.cache_warm(*args)
126
+ rescue StandardError => e
127
+ logger.error "Exception encountered when warming #{cacher.name}: #{e.inspect}. \n\t#{e.backtrace.join("\n\t")}"
128
+ end
129
+ end
123
130
  ensure
124
131
  Cacheable.cache_options_threaded = nil
125
132
  end
@@ -1,3 +1,3 @@
1
1
  module ForgetMeNot
2
- VERSION = '0.3.2.1'
2
+ VERSION = '0.3.2.2'
3
3
  end
@@ -63,6 +63,34 @@ module ForgetMeNot
63
63
 
64
64
  end
65
65
 
66
+ class TestClassException1
67
+ include Cacheable
68
+
69
+
70
+ class << self
71
+ attr_accessor :cache_warm_called
72
+ def cache_warm(*args)
73
+ self.cache_warm_called = true
74
+ raise "We're not going to take it"
75
+ end
76
+ end
77
+ end
78
+
79
+ class TestClassException2
80
+ include Cacheable
81
+
82
+ class << self
83
+ attr_accessor :cache_warm_called
84
+
85
+ def cache_warm(*args)
86
+ self.cache_warm_called = true
87
+ raise "We're not going to take it"
88
+ end
89
+ end
90
+
91
+ end
92
+
93
+
66
94
  describe Cacheable do
67
95
  before do
68
96
  Cacheable.log_cache_activity = true
@@ -104,7 +132,7 @@ module ForgetMeNot
104
132
  it 'should raise an error if called with a block on initial caching' do
105
133
  foo = TestClass.new
106
134
  expect do
107
- foo.method1 {'a block'}
135
+ foo.method1 { 'a block' }
108
136
  end.to raise_error 'Cannot pass blocks to cached methods'
109
137
  end
110
138
 
@@ -112,7 +140,7 @@ module ForgetMeNot
112
140
  foo = TestClass.new
113
141
  foo.method1
114
142
  expect do
115
- foo.method1 {'a block'}
143
+ foo.method1 { 'a block' }
116
144
  end.to raise_error 'Cannot pass blocks to cached methods'
117
145
  end
118
146
 
@@ -249,6 +277,16 @@ module ForgetMeNot
249
277
  expect(TestClass.count(:method4)).to eq 0
250
278
  expect(TestClass.count(:method5)).to eq 0
251
279
  end
280
+
281
+ it 'Cache warming should keep going when encountering exceptions' do
282
+ TestClassException1.cache_warm_called = false
283
+ TestClassException2.cache_warm_called = false
284
+
285
+ Cacheable.warm('foo')
286
+
287
+ expect(TestClassException1.cache_warm_called).to be_true
288
+ expect(TestClassException2.cache_warm_called).to be_true
289
+ end
252
290
  end
253
291
  end
254
292
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forget-me-not
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2.1
4
+ version: 0.3.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koan Health