configcat 8.0.0 → 8.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/configcat/configservice.rb +8 -7
- data/lib/configcat/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c56d0edbcf7a8b19dcf8f416207267a6f2c946008ede6cf56c8e490e0d1d6d6b
|
4
|
+
data.tar.gz: f8c90823173383727345ac58322cc91142df354e77c02bc5540182d2125b609e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 492f842a79e071e638d5f6884b3ad4a4c29a2cfe38d7205c320a5d31b36503bc4d43d64af6c52a056753ab0eec97fc14d2740d996adf458972e27d1557aa579a
|
7
|
+
data.tar.gz: 17860b6a2d09ab3fa65f5b3a858161145578c2e47f682e645a5ebf514ce792ec4be7fd3f21bcdaaa42f296613287854bc6a447ae3df36a9fa4057b87eca815e8
|
@@ -31,13 +31,14 @@ module ConfigCat
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def get_config
|
34
|
+
threshold = Utils::DISTANT_PAST
|
35
|
+
prefer_cached = @initialized.set?
|
34
36
|
if @polling_mode.is_a?(LazyLoadingMode)
|
35
|
-
|
36
|
-
|
37
|
-
[entry.config, entry.fetch_time] :
|
38
|
-
[nil, Utils::DISTANT_PAST]
|
37
|
+
threshold = Utils.get_utc_now_seconds_since_epoch - @polling_mode.cache_refresh_interval_seconds
|
38
|
+
prefer_cached = false
|
39
39
|
elsif @polling_mode.is_a?(AutoPollingMode) && !@initialized.set?
|
40
40
|
elapsed_time = Utils.get_utc_now_seconds_since_epoch - @start_time # Elapsed time in seconds
|
41
|
+
threshold = Utils.get_utc_now_seconds_since_epoch - @polling_mode.poll_interval_seconds
|
41
42
|
if elapsed_time < @polling_mode.max_init_wait_time_seconds
|
42
43
|
@initialized.wait(@polling_mode.max_init_wait_time_seconds - elapsed_time)
|
43
44
|
|
@@ -52,7 +53,7 @@ module ConfigCat
|
|
52
53
|
end
|
53
54
|
|
54
55
|
# If we are initialized, we prefer the cached results
|
55
|
-
entry, _ = fetch_if_older(
|
56
|
+
entry, _ = fetch_if_older(threshold, prefer_cached: prefer_cached)
|
56
57
|
return !entry.empty? ?
|
57
58
|
[entry.config, entry.fetch_time] :
|
58
59
|
[nil, Utils::DISTANT_PAST]
|
@@ -117,7 +118,7 @@ module ConfigCat
|
|
117
118
|
end
|
118
119
|
|
119
120
|
# :return [ConfigEntry, String] Returns the ConfigEntry object and error message in case of any error.
|
120
|
-
def fetch_if_older(threshold,
|
121
|
+
def fetch_if_older(threshold, prefer_cached: false)
|
121
122
|
# Sync up with the cache and use it when it's not expired.
|
122
123
|
@lock.synchronize do
|
123
124
|
# Sync up with the cache and use it when it's not expired.
|
@@ -134,7 +135,7 @@ module ConfigCat
|
|
134
135
|
end
|
135
136
|
|
136
137
|
# If we are in offline mode or the caller prefers cached values, do not initiate fetch.
|
137
|
-
if @is_offline ||
|
138
|
+
if @is_offline || prefer_cached
|
138
139
|
return @cached_entry, nil
|
139
140
|
end
|
140
141
|
end
|
data/lib/configcat/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configcat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.0.
|
4
|
+
version: 8.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ConfigCat
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|