opener-property-tagger 3.3.1 → 3.3.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6483ef2a01a413e280ed9555566499496748cb0b8c25ddd9853fb50165ab03f9
|
4
|
+
data.tar.gz: eb0f85d3d82aed282d21a3b51a0c75867b62c547b49fd1ceeaac374baff86111
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe31cb493644de7eaed474d9064e3f8880f229b8e05f0685aae18e730f5cd3d94c92aa403966904147b710f0e9589cffa840cf44ac83d64fc7f9c9211ffc6313
|
7
|
+
data.tar.gz: '0939965101de5ccd503bbdeae6b511552354d8f285e263b739b5d5f004ffdf03411fac5b4a97404f728bd1038f8320843c2dcb2f8ae70059eedc44e0682c4d71'
|
@@ -7,6 +7,8 @@ module Opener
|
|
7
7
|
|
8
8
|
include MonitorMixin
|
9
9
|
|
10
|
+
UPDATE_INTERVAL = (ENV['CACHE_EXPIRE_MINS']&.to_i || 5).minutes
|
11
|
+
|
10
12
|
def initialize
|
11
13
|
super
|
12
14
|
|
@@ -16,13 +18,9 @@ module Opener
|
|
16
18
|
|
17
19
|
def [] **params
|
18
20
|
synchronize do
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
23
|
-
else
|
24
|
-
@cache[params] = cache_update **params
|
25
|
-
end
|
21
|
+
existing = @cache[params]
|
22
|
+
break existing if existing and existing.from > UPDATE_INTERVAL.ago
|
23
|
+
@cache[params] = cache_update existing, **params
|
26
24
|
end
|
27
25
|
end
|
28
26
|
alias_method :get, :[]
|
@@ -31,7 +29,11 @@ module Opener
|
|
31
29
|
from = Time.now
|
32
30
|
lexicons = load_aspects cache: existing, **params
|
33
31
|
|
34
|
-
|
32
|
+
if existing and lexicons.blank?
|
33
|
+
existing.from = from
|
34
|
+
return existing
|
35
|
+
end
|
36
|
+
|
35
37
|
Hashie::Mash.new(
|
36
38
|
aspects: lexicons,
|
37
39
|
from: from,
|