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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 360b940ee0e89f6e86195d9ba17d4b08df9a8c3dedb237dc3c57e162f7c5cf22
4
- data.tar.gz: bf281cf73d78d460e7c9d327f5518d707064920f4ee74b15b2db8730b9e69628
3
+ metadata.gz: c56d0edbcf7a8b19dcf8f416207267a6f2c946008ede6cf56c8e490e0d1d6d6b
4
+ data.tar.gz: f8c90823173383727345ac58322cc91142df354e77c02bc5540182d2125b609e
5
5
  SHA512:
6
- metadata.gz: 8bbaae3fba88573a213cbd9d71e512f1ef9bb6b8d59c0a84ce77a867b4df610aaa1a2d5cdfa0fb252db78b53e4522fcd1bb450f7e232b233e4a8f422beab0c39
7
- data.tar.gz: 23172cbd4aa0e5620bfd8b18ce6274f28b9b3ab8c10b13033d545ddf02e1c7dad95bba4f77add31a5b6013395760862841d718ff8a0b5d5b510a778d94889434
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
- entry, _ = fetch_if_older(Utils.get_utc_now_seconds_since_epoch - @polling_mode.cache_refresh_interval_seconds)
36
- return !entry.empty? ?
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(Utils::DISTANT_PAST, prefer_cache: @initialized.set?)
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, prefer_cache: false)
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 || prefer_cache
138
+ if @is_offline || prefer_cached
138
139
  return @cached_entry, nil
139
140
  end
140
141
  end
@@ -1,3 +1,3 @@
1
1
  module ConfigCat
2
- VERSION = "8.0.0"
2
+ VERSION = "8.0.1"
3
3
  end
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.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-03-08 00:00:00.000000000 Z
11
+ date: 2024-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby